code: def _str_to_datetime(datestr):
      
      # try known string
      try:
          return DATE_STRINGS[str(datestr).lower()]()
      except KeyError:  # any other string
          pass
  
      # use maya
      try:
          import maya
          return maya.when(datestr).datetime()
      except ImportError:
          pass
  
      # use dateutil.parse
      with warnings.catch_warnings():
          # don't allow lazy passing of time-zones
          warnings.simplefilter("error", RuntimeWarning)
          try:
              return dateparser.parse(datestr)
          except RuntimeWarning:
              raise ValueError("Cannot parse date string with timezone "
                               "without maya, please install maya")
          except (ValueError, TypeError) as exc:  # improve error reporting
              exc.args = ("Cannot parse date string {0!r}: {1}".format(
                  datestr, exc.args[0]),)
              raise
docs: Convert `str` to `datetime.datetime`.