def method(nm, *args):
    """Return a function that invokes the named method with the optional args.
    Ex: map(method('upper'), ['a', 'b', 'cee']) ==> ['A', 'B', 'CEE']
    map(method('count', 't'), ['this', 'is', 'a', 'test']) ==> [1, 0, 0, 2]"""
    return lambda x: getattr(x, nm)(*args)