@staticmethod
def _str_to_bytes(size):
    """Parse ``size`` and return the number of bytes it names.
        See :attr:`.Media.size` for more information on this conversion."""
    units = {'b': 1, 'kb': 1000, 'kib': 1024, 'mb': 1000 ** 2, 'mib': 1024 **
        2, 'gb': 1000 ** 3, 'gib': 1024 ** 3, 'tb': 1000 ** 4, 'tib': 1024 ** 4
        }
    size = str(size).lower().strip().replace(' ', '')
    number = float(size.rstrip('bkimgt'))
    unit = size.lstrip('0123456789.')
    try:
        return round(number * units[unit])
    except KeyError:
        raise ValueError('The unit %s was not recognized.' % unit)
