docs: def select(self, return_models=False, nest=False, bypass_safe_limit=False, sql=None, sql_args=None):
          """
          Executes the SELECT statement and returns the rows as a list of dictionaries or a list of
          model instances
  
          :type return_models: bool
          :param return_models: Set to True to return a list of models instead of a list of dictionaries.
              Defaults to False
  
          :type nest: bool
          :param nest: Set to True to treat all double underscores in keynames as nested data. This will
              convert all keys with double underscores to dictionaries keyed off of the left side of
              the underscores. Ex: {"id": 1", "account__id": 1, "account__name": "Name"} becomes
              {"id": 1, "account": {"id": 1, "name": "Name"}}
  
          :type bypass_safe_limit: bool
          :param bypass_safe_limit: Ignores the safe_limit option even if the safe_limit is enabled
  
          :type sql: str or None
          :param sql: The sql to execute in the SELECT statement. If one is not specified, then the
              query will use ``self.get_sql()``
  
          :type sql_args: str or None
          :param sql_args: The sql args to be used in the SELECT statement. If none are specified, then
              the query wil use ``self.get_args()``
  
          :rtype: list of dict
          :return: list of dictionaries of the rows
          """
          # Check if we need to set a safe limit
          if bypass_safe_limit is False:
              if Query.enable_safe_limit:
                  if self.count() > Query.safe_limit:
                      self.limit(Query.safe_limit)
  
          # determine which sql to use
          if sql is None:
              sql = self.get_sql()
  
          # determine which sql args to use
          if sql_args is None:
              sql_args = self.get_args()
  
          # get the cursor to execute the query
          cursor = self.get_cursor()
  
          # execute the query
          cursor.execute(sql, sql_args)
  
          # get the results as a list of dictionaries
          rows = self._fetch_all_as_dict(cursor)
  
          # check if models should be returned instead of dictionaries
          if return_models:
  
              # set nesting to true, so the nested models can easily load the data
              nest = True
  
              # build model map of map name to model
              model_map = {}
              for join_item in self.joins:
                  model_map[join_item.right_table.field_prefix] = join_item.right_table.model
  
          # check if results should be nested
          if nest:
  
              # convert keys with double underscores to dictionaries
              for row in rows:
                  _row = row.copy()
                  for key, value in _row.items():
                      set_value_for_keypath(row, key, value, True, '__')
                      if '__' in key:
                          row.pop(key)
  
              # create models if needed
              if return_models:
                  model_class = self.tables[0].model
                  new_rows = []
                  for row in rows:
                      model = model_class()
                      # assign all non-model keys first because django 1.5 requires
                      # that the model has an id set before setting a property that is
                      # a foreign key
                      for key, value in row.items():
                          if key not in model_map:
                              setattr(model, key, value)
                      # assign all model instances
                      for key, value in row.items():
                          if key in model_map:
                              child_model = model_map[key]()
                              for child_key, child_value in value.items():
                                  setattr(child_model, child_key, child_value)
                              value = child_model
                          setattr(model, key, value)
                      new_rows.append(model)
                  rows = new_rows
  
          return rows