code: def _format_char(char):
      
      if char is None:
          return -1
      if isinstance(char, _STRTYPES) and len(char) == 1:
          return ord(char)
      try:
          return int(char) # allow all int-like objects
      except:
          raise TypeError('char single character string, integer, or None\nReceived: ' + repr(char))
docs: Prepares a single character for passing to ctypes calls, needs to return
      an integer but can also pass None which will keep the current character
      instead of overwriting it.
  
      This is called often and needs to be optimized whenever possible.