def format_size(size):
    """Convert a size in bytes into a human readable string.

    Example
    -------
    ::

        >>>format_size(2.25*1024)
        '2.25 kB'

    Parameters
    ----------
    size : int
        Size in bytes.

    Returns
    -------
    str
    """
    for unit in ['bytes', 'kB', 'MB']:
        if size < 1024:
            return '{:.2f} {}'.format(size, unit)
        size /= 1024
    return '{:.2f} {}'.format(size, 'GB')
