def human_readable_size(size):
    """
    Returns an approximate, human-readable,
    file size.

    :param size: an integer-like object
    :returns: a human-readable size as a string
    :raises: RunetimeError if file size exceeds petabytes (or is negative)
    """
    if (size>=0):
        for x in ['B','KB','MB','GB','TB','PB']:
            if size<1024:
                return ("%3.1f%s" if x!='B' else "%d%s") % (size, x)
            size/=1024.0

    raise RuntimeError("file size suspiciously large")