code: def _to_python(self, value):
          
          if isinstance(value, (int, float, long, complex)):
              return value
  
          if isinstance(value, (list, tuple)):
              value = value[0]
  
          if value == 'true':
              return True
          elif value == 'false':
              return False
  
          is_string = False
  
          if IS_PY3:
              if isinstance(value, bytes):
                  value = force_unicode(value)
  
              if isinstance(value, str):
                  is_string = True
          else:
              if isinstance(value, str):
                  value = force_unicode(value)
  
              if isinstance(value, basestring):  # NOQA: F821
                  is_string = True
  
          if is_string:
              possible_datetime = DATETIME_REGEX.search(value)
  
              if possible_datetime:
                  date_values = possible_datetime.groupdict()
  
                  for dk, dv in date_values.items():
                      date_values[dk] = int(dv)
  
                  return datetime.datetime(date_values['year'],
                                           date_values['month'],
                                           date_values['day'],
                                           date_values['hour'],
                                           date_values['minute'],
                                           date_values['second'])
  
          try:
              # This is slightly gross but it's hard to tell otherwise what the
              # string's original type might have been.
              return ast.literal_eval(value)
          except (ValueError, SyntaxError):
              # If it fails, continue on.
              pass
  
          return value
docs: Converts values from Solr to native Python values.