def mapattr(value, arg):
    """
    Maps an attribute from a list into a new list.

    e.g. value = [{'a': 1}, {'a': 2}, {'a': 3}]
         arg = 'a'
         result = [1, 2, 3]
    """
    if len(value) > 0:
        res = [getattr(o, arg) for o in value]
        return res
    else:
        return []