def git_hash(blob):
    """Return git-hash compatible SHA-1 hexdigits for a blob of data."""
    head = str("blob " + str(len(blob)) + "\0").encode("utf-8")
    return sha1(head + blob).hexdigest()
Return git-hash compatible SHA-1 hexdigits for a blob of data.