import base64


def format_digest(hasher):
    """The Hashdist standard format for encoding hash digests

    This is one of the cases where it is prudent to just repeat the
    implementation in the docstring::

        base64.b32encode(hasher.digest()[:20]).lower()

    Parameters
    ----------
    hasher : hasher object
        An object with a `digest` method (a :class:`Hasher` or
        an object from the :mod:`hashlib` module)
    """
    return base64.b32encode(hasher.digest()[:20]).lower()