human
I wrote the below code

    if ((not isinstance(attribute, basestring)) or ('.' not in attribute)):
        return (lambda x: environment.getitem(x, attribute))
    attribute = attribute.split('.')
    def attrgetter(item):
        for part in attribute:
            item = environment.getitem(item, part)
        return item
    return attrgetter

What's a good function header?
assistant
#Here's a good function header.

def make_attrgetter(environment, attribute):