code: def to_bytesize(value, default_unit=None, base=DEFAULT_BASE):
      
      if isinstance(value, (int, float)):
          return unitized(value, default_unit, base)
  
      if value is None:
          return None
  
      try:
          if value[-1].lower() == "b":
              # Accept notations such as "1mb", as they get used out of habit
              value = value[:-1]
  
          unit = value[-1:].lower()
          if unit.isdigit():
              unit = default_unit
  
          else:
              value = value[:-1]
  
          return unitized(to_number(float, value), unit, base)
  
      except (IndexError, TypeError, ValueError):
          return None
docs: Convert `value` to bytes, accepts notations such as "4k" to mean 4096 bytes
  
      Args:
          value (str | unicode | int | None): Number of bytes optionally suffixed by a char from UNITS
          default_unit (str | unicode | None): Default unit to use for unqualified values
          base (int): Base to use (usually 1024)
  
      Returns:
          (int | None): Deduced bytesize value, if possible