def add_sr(path, sr_path=True, nocname=False, force_hostname=False, retain_extension=True, force_https=False, force_extension=None):
 if path.startswith(('#', 'javascript:')):
  return path
 u = UrlParser(path)
 if sr_path:
  u.path_add_subreddit(c.site)
 if ((not u.hostname) or force_hostname):
  u.hostname = get_domain(subreddit=False)
 if ((c.secure and u.is_reddit_url()) or force_https):
  u.scheme = 'https'
 if (force_extension is not None):
  u.set_extension(force_extension)
 elif retain_extension:
  if (c.render_style == 'mobile'):
   u.set_extension('mobile')
  elif (c.render_style == 'compact'):
   u.set_extension('compact')
 return u.unparse()

def add_sr ( path , sr_path = True , nocname = False , force_hostname = False , retain_extension = True , force_https = False , force_extension = None ) : if path . startswith ( ( '#' , 'javascript:' ) ) : return path u = UrlParser ( path ) if sr_path : u . path_add_subreddit ( c . site ) if ( ( not u . hostname ) or force_hostname ) : u . hostname = get_domain ( subreddit = False ) if ( ( c . secure and u . is_reddit_url ( ) ) or force_https ) : u . scheme = 'https' if ( force_extension is not None ) : u . set_extension ( force_extension ) elif retain_extension : if ( c . render_style == 'mobile' ) : u . set_extension ( 'mobile' ) elif ( c . render_style == 'compact' ) : u . set_extension ( 'compact' ) return u . unparse ( )
given a path .