Get the modification time of a file, or -1 if the file does not exist.

def mtime(path):
    """Get the modification time of a file, or -1 if the file does not exist.
    """
    if not os.path.exists(path):
        return -1
    stat = os.stat(path)
    return stat.st_mtime