def fingerprint(dirnames, prefix=None, previous=[]):
    #pylint:disable=dangerous-default-value
    """
    Returns a list of paths available from *dirname*. When previous
    is specified, returns a list of additional files only.

    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 dirname in dirnames:
        for filename in os.listdir(dirname):
            fullpath = os.path.join(dirname, filename)
            if os.path.isdir(fullpath):
                results += fingerprint(
                    [fullpath], prefix=filename, previous=previous)
            else:
                fullname = fullpath
                if prefix and fullname.startswith(prefix):
                    fullname = fullname[len(prefix):]
                found = False
                for prevpath in previous:
                    if fullname == prevpath['Key']:
                        found = True
                        break
                if not found:
                    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
def fingerprint ( dirnames , prefix = None , previous = [ ] ) : results = [ ] for dirname in dirnames : for filename in os . listdir ( dirname ) : fullpath = os . path . join ( dirname , filename ) if os . path . isdir ( fullpath ) : results += fingerprint ( [ fullpath ] , prefix = filename , previous = previous ) else : fullname = fullpath if prefix and fullname . startswith ( prefix ) : fullname = fullname [ len ( prefix ) : ] found = False for prevpath in previous : if fullname == prevpath [ 'Key' ] : found = True break if not found : 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
Returns a list of paths available from *dirname*. When previous
    is specified, returns a list of additional files only.

    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"},
    ]