def local_site_reverse(viewname, request=None, local_site_name=None, local_site=None, args=None, kwargs=None, *func_args, **func_kwargs):
 assert (not (local_site_name and local_site))
 if (request or local_site_name or local_site):
  if local_site:
   local_site_name = local_site.name
  elif (request and (not local_site_name)):
   local_site_name = getattr(request, u'_local_site_name', None)
  if local_site_name:
   if args:
    new_args = ([local_site_name] + list(args))
    new_kwargs = kwargs
   else:
    new_args = args
    new_kwargs = {u'local_site_name': local_site_name}
    if kwargs:
     new_kwargs.update(kwargs)
   try:
    return reverse(viewname, args=new_args, kwargs=new_kwargs, *func_args, **func_kwargs)
   except NoReverseMatch:
    pass
 return reverse(viewname, args=args, kwargs=kwargs, *func_args, **func_kwargs)

def local_site_reverse ( viewname , request = None , local_site_name = None , local_site = None , args = None , kwargs = None , * func_args , ** func_kwargs ) : assert ( not ( local_site_name and local_site ) ) if ( request or local_site_name or local_site ) : if local_site : local_site_name = local_site . name elif ( request and ( not local_site_name ) ) : local_site_name = getattr ( request , u'_local_site_name' , None ) if local_site_name : if args : new_args = ( [ local_site_name ] + list ( args ) ) new_kwargs = kwargs else : new_args = args new_kwargs = { u'local_site_name' : local_site_name } if kwargs : new_kwargs . update ( kwargs ) try : return reverse ( viewname , args = new_args , kwargs = new_kwargs , * func_args , ** func_kwargs ) except NoReverseMatch : pass return reverse ( viewname , args = args , kwargs = kwargs , * func_args , ** func_kwargs )
reverse a url name and return a working url .