Returns a list of all files (recursively) present in a directory
    with their timestamp.

    Example:
    [{ "Key": "abc.txt",
       "LastModified": "Mon, 05 Jan 2015 12:00:00 UTC"},
     { "Key": "def.txt",
       "LastModified": "Mon, 05 Jan 2015 12:00:001 UTC"},
    ]

def list_local(paths, prefix=None):
    """
    Returns a list of all files (recursively) present in a directory
    with their timestamp.

    Example:
    [{ "Key": "abc.txt",
       "LastModified": "Mon, 05 Jan 2015 12:00:00 UTC"},
     { "Key": "def.txt",
       "LastModified": "Mon, 05 Jan 2015 12:00:001 UTC"},
    ]
    """
    results = []
    for path in paths:
        if os.path.isdir(path):
            for filename in os.listdir(path):
                fullpath = os.path.join(path, filename)
                if os.path.isdir(fullpath):
                    results += list_local([fullpath], prefix)
                else:
                    fullname = fullpath
                    if prefix and fullname.startswith(prefix):
                        fullname = fullname[len(prefix):]
                    mtime = datetime.datetime.fromtimestamp(
                        os.path.getmtime(fullpath), tz=utc)
                    results += [{"Key": fullname,
                        "LastModified": mtime.strftime(
                                '%a, %d %b %Y %H:%M:%S %Z')}]
        else:
            fullpath = path
            fullname = fullpath
            if prefix and fullname.startswith(prefix):
                fullname = fullname[len(prefix):]
            mtime = datetime.datetime.fromtimestamp(
                os.path.getmtime(fullpath), tz=utc)
            results += [{"Key": fullname,
                "LastModified": mtime.strftime(
                        '%a, %d %b %Y %H:%M:%S %Z')}]
    return results