<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def autodiscover():
 """Autodiscover for urls.py"""

    # Get permissions based on urlpatterns from urls.py
    url_conf = getattr(settings, 'ROOT_URLCONF', ())
    resolver = urlresolvers.get_resolver(url_conf)
    urlpatterns = resolver.url_patterns
    permissions = generate_permissions(urlpatterns)
    # Refresh permissions
    refresh_permissions(permissions)