import re


def human2bytes(s):
    """
    >>> human2bytes('1M')
    1048576
    >>> human2bytes('1G')
    1073741824
    """
    symbols = ('Byte', 'KiB', 'MiB', 'GiB', 'T', 'P', 'E', 'Z', 'Y')
    num = re.findall(r"[0-9\.]+", s)
    assert (len(num) == 1)
    num = num[0]
    num = float(num)
    for i, n in enumerate(symbols):
        if n in s:
            multiplier = 1 << (i)*10
            return int(num * multiplier)
    raise Exception('human number not parsable')