import hashlib


def get_file_hash(filepath):
    """
        Calculate file sha1
    """

    sha1 = hashlib.sha1()
    f = open(filepath, 'rb')
    try:
        sha1.update(f.read())
    finally:
        f.close()
    return sha1.hexdigest()