code: def to_int(value: str) -> int:
      
      if is_0x_prefixed(value):
          if len(value) == 2:
              return 0
          else:
              return int(value, 16)
      else:
          return int(value)
docs: Robust to integer conversion, handling hex values, string representations,
      and special cases like `0x`.