code: def format_character(char):
      
      if \
          char in string.ascii_letters \
          or char in string.digits \
          or char in [
                  '_', '.', ':', ';', ' ', '!', '?', '+', '-', '/', '=', '<',
                  '>', '$', '(', ')', '@', '~', '`', '|', '#', '[', ']', '{',
                  '}', '&', '*', '^', '%']:
          return char
      elif char in ['"', '\'', '\\']:
          return '\\{0}'.format(char)
      elif char == '\n':
          return '\\n'
      elif char == '\r':
          return '\\r'
      elif char == '\t':
          return '\\t'
      else:
          return '\\x{:02x}'.format(ord(char))
docs: Returns the C-formatting of the character