code: def byteToInt(byte):
      
      if hasattr(byte, 'bit_length'):
          # This is already an int
          return byte
      return ord(byte) if hasattr(byte, 'encode') else byte[0]
docs: byte -> int
  
      Determines whether to use ord() or not to get a byte's value.