text: # -*- coding: utf-8 -*-
  #
  #  Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu>
  #
  #  Licensed under the Apache License, Version 2.0 (the "License");
  #  you may not use this file except in compliance with the License.
  #  You may obtain a copy of the License at
  #
  #      https://www.apache.org/licenses/LICENSE-2.0
  #
  #  Unless required by applicable law or agreed to in writing, software
  #  distributed under the License is distributed on an "AS IS" BASIS,
  #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  #  See the License for the specific language governing permissions and
  #  limitations under the License.
  
  """Python compatibility wrappers."""
  
  import sys
  from struct import pack
  
  MAX_INT = sys.maxsize
  MAX_INT64 = (1 << 63) - 1
  MAX_INT32 = (1 << 31) - 1
  MAX_INT16 = (1 << 15) - 1
  
  # Determine the word size of the processor.
  if MAX_INT == MAX_INT64:
      # 64-bit processor.
      MACHINE_WORD_SIZE = 64
  elif MAX_INT == MAX_INT32:
      # 32-bit processor.
      MACHINE_WORD_SIZE = 32
  else:
      # Else we just assume 64-bit processor keeping up with modern times.
      MACHINE_WORD_SIZE = 64
  
  integer_types = (int, )
  range = range
  zip = zip
  
  
  def is_integer(obj):
      """
      Determines whether the given value is an integer.
  
      :param obj:
          The value to test.
      :returns:
          ``True`` if ``value`` is an integer; ``False`` otherwise.
      """
      return isinstance(obj, integer_types)
  
  
  def byte(num):
      """
      Converts a number between 0 and 255 (both inclusive) to a base-256 (byte)
      representation.
  
      Use it as a replacement for ``chr`` where you are expecting a byte
      because this will work on all current versions of Python::
  
      :param num:
          An unsigned integer between 0 and 255 (both inclusive).
      :returns:
          A single byte.
      """
      return pack("B", num)
  