def bytes2human(n):
    """
    Convert n bytes (as integer) to a human readable string.  Code was found
    online at activestate (see references).

    **Parameters**

        n: *int*
            The number of bytes.

    **Returns**

        n_in_str: *str*
            The bytes in string format.

    **References**

        - http://code.activestate.com/recipes/578019
    """
    symbols = 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'
    prefix = {}
    for i, s in enumerate(symbols):
        prefix[s] = 1 << (i + 1) * 10
    for s in reversed(symbols):
        if n >= prefix[s]:
            value = float(n) / prefix[s]
            return '%.1f%s' % (value, s)
    return '%sB' % n
