def human2bytes(size, unit, *, precision=2, base=1024):
    """
    Convert size from human to bytes.

    Arguments:
        size       (int): number
        unit       (str): converts from this unit to bytes
                          'KB', 'MB', 'GB', 'TB', 'PB', 'EB'

    Keyword arguments (opt):
        precision  (int): number of digits after the decimal point
                          default is 2
        base       (int): 1000 - for decimal base
                          1024 - for binary base (it is the default)

    Returns:
        (int) number in bytes

    Example:
    >>> human2bytes(10, 'GB')
    '10737418240.00'
    >>> human2bytes(10, 'GB', precision=0)
    '10737418240'
    >>> human2bytes(10, 'PB')
    '11258999068426240.00'

    """
    dic_power = {
        "KB": base,
        "MB": base ** 2,
        "GB": base ** 3,
        "TB": base ** 4,
        "PB": base ** 5,
        "EB": base ** 6,
        "ZB": base ** 7,
    }
    if unit not in dic_power:
        raise ValueError(
            "invalid unit. It must be {}".format(", ".join(dic_power.keys()))
        )

    try:
        num_bytes = float(size) * int(dic_power[unit])
    except ValueError:
        raise ValueError("value is not a number")

    return "{0:.{prec}f}".format(num_bytes, prec=precision)