def format_suffix_patterns(urlpatterns, suffix_required=False, allowed=None):
 suffix_kwarg = api_settings.FORMAT_SUFFIX_KWARG
 if allowed:
  if (len(allowed) == 1):
   allowed_pattern = allowed[0]
  else:
   allowed_pattern = ('(%s)' % '|'.join(allowed))
  suffix_pattern = ('\\.(?P<%s>%s)$' % (suffix_kwarg, allowed_pattern))
 else:
  suffix_pattern = ('\\.(?P<%s>[a-z0-9]+)$' % suffix_kwarg)
 return apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required)

def format_suffix_patterns ( urlpatterns , suffix_required = False , allowed = None ) : suffix_kwarg = api_settings . FORMAT_SUFFIX_KWARG if allowed : if ( len ( allowed ) == 1 ) : allowed_pattern = allowed [ 0 ] else : allowed_pattern = ( '(%s)' % '|' . join ( allowed ) ) suffix_pattern = ( '\\.(?P<%s>%s)$' % ( suffix_kwarg , allowed_pattern ) ) else : suffix_pattern = ( '\\.(?P<%s>[a-z0-9]+)$' % suffix_kwarg ) return apply_suffix_patterns ( urlpatterns , suffix_pattern , suffix_required )
supplement existing urlpatterns with corresponding patterns that also include a .