import operator


def map_method(*args, **kwargs):
    """
    Given a method name and a sequence of models, return a sequence of values
    of applying the extra positional and keyword arguments in each method.

    Attr:
        attr:
            Method name. Dotted python names are valid.
        models:
            A sequence of models.
        *args, **kwargs:
            Arguments to pass to m.<attr>(*args, **kwargs)
    """
    attr, data, *args = args
    attr, _, method = attr.partition(".")
    if method:
        data = map(operator.attrgetter(attr), data)
        return map(operator.methodcaller(method, *args, **kwargs), data)
    else:
        return map(operator.methodcaller(attr, *args, **kwargs), data)