docs: def parse_size(value):
      """
      >>> parse_size('1M')
      1048576
      >>> parse_size('512K512K')
      1048576
      >>> parse_size('512K 512K')
      1048576
      >>> parse_size('512K 512K 4')
      1048580
      """
      if isinstance(value, (int, float)):
          return value
      elif not pattern_valid.fullmatch(value):
          raise ValueError(value)
  
      result = 0
      for m in pattern.finditer(value):
          v = m.groupdict()
          n = int(v['n'])
          unit = v['unit']
          if not unit:
              result += n
          elif unit in size_levels:
              result += n << size_levels[unit]
          else:
              raise ValueError(value)
      return result