code: def as_url(cls, api=None, name_prefix='', url_prefix=''):
          
          url_prefix = url_prefix and "%s/" % url_prefix
          name_prefix = name_prefix and "%s-" % name_prefix
  
          url_regex = '^%s%s/?$' % (
              url_prefix, cls._meta.url_regex.lstrip('^').rstrip('/$'))
          url_regex = url_regex.replace('//', '/')
          url_name = '%s%s' % (name_prefix, cls._meta.url_name)
  
          return url(url_regex, cls.as_view(api=api), name=url_name)
docs: Generate url for resource.
  
          :return RegexURLPattern: Django URL