code: def any2i(self, pkt, x):
          # type: (Optional[packet.Packet], Union[None, str, int]) -> Optional[int]  # noqa: E501
          
          if isinstance(x, type(None)):
              return x
          if isinstance(x, six.integer_types):
              assert(x >= 0)
              ret = self.h2i(pkt, x)
              assert(isinstance(ret, six.integer_types) and ret >= 0)
              return ret
          elif isinstance(x, bytes):
              ret = self.m2i(pkt, x)
              assert (isinstance(ret, six.integer_types) and ret >= 0)
              return ret
          assert False, 'EINVAL: x: No idea what the parameter format is'
docs: A "x" value as a string is parsed as a binary encoding of a UVarInt. An int is considered an internal value.  # noqa: E501
            None is returned as is.
  
          @param packet.Packet|None pkt: the packet containing this field; probably unused.  # noqa: E501
          @param str|int|None x: the value to convert.
          @return int|None: the converted value.
          @raise AssertionError