  import datetime
  from importlib import reload as reload_module
  
  import django
  import pytest
  from django.core.exceptions import ImproperlyConfigured
  from django.db import models
  from django.db.models import CharField, Transform
  from django.db.models.functions import Concat, Upper
 
</s> remove from rest_framework.compat import URLPattern, URLResolver, get_original_route
 </s> add  </s> remove     @pytest.mark.skipif(django.VERSION[:2] < (2, 2), reason="requires django 2.2 or higher")
 </s> add  </s> remove try:
    from django.urls import (  # noqa
        URLPattern,
        URLResolver,
    )
except ImportError:
    # Will be removed in Django 2.0
    from django.urls import (  # noqa
        RegexURLPattern as URLPattern,
        RegexURLResolver as URLResolver,
    )


def get_original_route(urlpattern):
    """
    Get the original route/regex that was typed in by the user into the path(), re_path() or url() directive. This
    is in contrast with get_regex_pattern below, which for RoutePattern returns the raw regex generated from the path().
    """
    if hasattr(urlpattern, 'pattern'):
        # Django 2.0
        return str(urlpattern.pattern)
    else:
        # Django < 2.0
        return urlpattern.regex.pattern


def get_regex_pattern(urlpattern):
    """
    Get the raw regex out of the urlpattern's RegexPattern or RoutePattern. This is always a regular expression,
    unlike get_original_route above.
    """
    if hasattr(urlpattern, 'pattern'):
        # Django 2.0
        return urlpattern.pattern.regex.pattern
    else:
        # Django < 2.0
        return urlpattern.regex.pattern


def is_route_pattern(urlpattern):
    if hasattr(urlpattern, 'pattern'):
        # Django 2.0
        from django.urls.resolvers import RoutePattern
        return isinstance(urlpattern.pattern, RoutePattern)
    else:
        # Django < 2.0
        return False


def make_url_resolver(regex, urlpatterns):
    try:
        # Django 2.0
        from django.urls.resolvers import RegexPattern
        return URLResolver(RegexPattern(regex), urlpatterns)

    except ImportError:
        # Django < 2.0
        return URLResolver(regex, urlpatterns)

 </s> add  </s> remove from django.urls import Resolver404, path, re_path
 </s> add from django.urls import Resolver404, URLResolver, path, re_path
from django.urls.resolvers import RegexPattern
  import datetime
  from importlib import reload as reload_module
  

  import pytest
  from django.core.exceptions import ImproperlyConfigured
  from django.db import models
  from django.db.models import CharField, Transform
  from django.db.models.functions import Concat, Upper
keep keep keep replace keep keep keep keep keep
 Drop all compat support to Django < 2 urls (#7337) 
tests/test_filters.py