code: def get_default_role(request):
      
      global DEFAULT_ROLE
      default = getattr(settings, "OPENSTACK_KEYSTONE_DEFAULT_ROLE", None)
      if default and DEFAULT_ROLE is None:
          try:
              roles = keystoneclient(request, admin=True).roles.list()
          except Exception:
              roles = []
              exceptions.handle(request)
          for role in roles:
              if default in (role.id, role.name):
                  DEFAULT_ROLE = role
                  break
      return DEFAULT_ROLE
docs: Gets the default role object from Keystone and saves it as a global.
  
      Since this is configured in settings and should not change from request
      to request. Supports lookup by name or id.