def ifetch_single(iterable, key, default=EMPTY, getter=None):
def _getter(item):<EOL><INDENT>if getter:<EOL><INDENT>custom_getter = partial(getter, key=key)<EOL>return custom_getter(item)<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>attrgetter = operator.attrgetter(key)<EOL>return attrgetter(item)<EOL><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>itemgetter = operator.itemgetter(key)<EOL>return itemgetter(item)<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT>if default is not EMPTY:<EOL><INDENT>return default<EOL><DEDENT>raise ValueError('<STR_LIT>' % (item, key))<EOL><DEDENT><DEDENT>return map(_getter, iterable)<EOL>
getter() g(item, key):pass