code: def human_size_to_bytes(human_size):
      '''
      Convert human-readable units to bytes
      '''
      size_exp_map = {'K': 1, 'M': 2, 'G': 3, 'T': 4, 'P': 5}
      human_size_str = six.text_type(human_size)
      match = re.match(r'^(\d+)([KMGTP])?$', human_size_str)
      if not match:
          raise ValueError(
              'Size must be all digits, with an optional unit type '
              '(K, M, G, T, or P)'
          )
      size_num = int(match.group(1))
      unit_multiplier = 1024 ** size_exp_map.get(match.group(2), 0)
      return size_num * unit_multiplief human_size_to_bytes(human_size):
      '''
      Convert human-readable units to bytes
      '''
      size_exp_map = {'K': 1, 'M': 2, 'G': 3, 'T': 4, 'P': 5}
      human_size_str = six.text_type(human_size)
      match = re.match(r'^(\d+)([KMGTP])?$', human_size_str)
      if not match:
          raise ValueError(
              'Size must be all digits, with an optional unit type '
              '(K, M, G, T, or P)'
          )
      size_num = int(match.group(1))
      unit_multiplier = 1024 ** size_exp_map.get(match.group(2), 0)
      return size_num * unit_multiplier
docs: Convert human-readable units to bytes