def human_readable_size(filesize=0):
    """
    Converts number of bytes from *filesize* to human-readable format.
    e.g. 2048 is converted to "2 kB".

    # Parameters:
    filesize (int): The size of file in bytes.

    # Return:
    str: Human-readable size.
    """

    for unit in ["", "k", "M", "G", "T", "P"]:
        if filesize < 1024:
            return "{} {}B".format(
                "{:.2f}".format(filesize).rstrip("0").rstrip("."), unit
            )
        filesize = filesize / 1024
    return "0 B"