code: def url_to_attrs_dict(url, url_attr):
      
      result = dict()
      # If url is not a string, it should be a dict
      if isinstance(url, six.string_types):
          url_value = url
      else:
          try:
              url_value = url["url"]
          except TypeError:
              raise BootstrapError(
                  'Function "url_to_attrs_dict" expects a string or a dict with key "url".'
              )
          crossorigin = url.get("crossorigin", None)
          integrity = url.get("integrity", None)
          if crossorigin:
              result["crossorigin"] = crossorigin
          if integrity:
              result["integrity"] = integrity
      result[url_attr] = url_value
      return result
docs: Sanitize url dict as used in django-bootstrap3 settings.