def keys_from_hash(hexdigest):
    """
    Return a cache keys triple for a hash hexdigest string.

    NOTE: since we use the first character and next two characters as directories, we
    create at most 16 dir at the first level and 16 dir at the second level for each
    first level directory for a maximum total of 16*16 = 256 directories. For a
    million files we would have about 4000 files per directory on average with this
    scheme which should keep most file systems happy and avoid some performance
    issues when there are too many files in a single directory.

    For example:
    >>> expected = ('f', 'b', '87db2bb28e9501ac7fdc4812782118f4c94a0f')
    >>> assert expected == keys_from_hash('fb87db2bb28e9501ac7fdc4812782118f4c94a0f')
    """
    return hexdigest[0], hexdigest[1], hexdigest[2:]