docs: def parse_db_settings(self, settings):
          """ Parse out database settings from filename or DJANGO_SETTINGS_MODULE. """
          if settings == 'DJANGO_SETTINGS_MODULE':
              django_settings = os.environ.get('DJANGO_SETTINGS_MODULE')
              self.print_message("Getting settings file from DJANGO_SETTINGS_MODULE=%s"
                                 % django_settings)
              path_pieces = django_settings.split('.')
              path_pieces[-1] = '%s.py' % path_pieces[-1]
              settings = os.path.join(*path_pieces)
  
          self.print_message("Parsing settings from settings file '%s'" % settings)
          parser = DatabaseSettingsParser()
          with open(settings) as settings_file:
              settings_ast = ast.parse(settings_file.read())
              parser.visit(settings_ast)
  
          try:
              return parser.database_settings['default']
          except KeyError as e:
              self.error("Missing key or value for: %s\nSettings must be of the form: %s"
                         % (e, self.settings_format))