code: def isidentifier(s, dotted=False):
      '''
      A function equivalent to the str.isidentifier method on Py3
      '''
      if dotted:
          return all(isidentifier(a) for a in s.split('.'))
      if PY3:
          return s.isidentifier()
      else:
          import re
          _name_re = re.compile(r"[a-zA-Z_][a-zA-Z0-9_]*$")
          return bool(_name_re.match(s)f isidentifier(s, dotted=False):
      '''
      A function equivalent to the str.isidentifier method on Py3
      '''
      if dotted:
          return all(isidentifier(a) for a in s.split('.'))
      if PY3:
          return s.isidentifier()
      else:
          import re
          _name_re = re.compile(r"[a-zA-Z_][a-zA-Z0-9_]*$")
          return bool(_name_re.match(s))
docs: A function equivalent to the str.isidentifier method on Py3