def firstmethod(method, on_call=None):
 def _matcher(it, *args, **kwargs):
  for obj in it:
   try:
    meth = getattr(maybe_evaluate(obj), method)
    reply = (on_call(meth, *args, **kwargs) if on_call else meth(*args, **kwargs))
   except AttributeError:
    pass
   else:
    if (reply is not None):
     return reply
 return _matcher

def firstmethod ( method , on_call = None ) : def _matcher ( it , * args , ** kwargs ) : for obj in it : try : meth = getattr ( maybe_evaluate ( obj ) , method ) reply = ( on_call ( meth , * args , ** kwargs ) if on_call else meth ( * args , ** kwargs ) ) except AttributeError : pass else : if ( reply is not None ) : return reply return _matcher
returns a functions that with a list of instances .