def get_api_url(base, parts=[], params=None):
 if (('api' in parts) and (parts.index('api') != 0)):
  parts.pop(parts.index('api'))
  parts.insert(0, 'api')
 elif ('api' not in parts):
  parts.insert(0, 'api')
 url = util.build_url(base, pathspec=parts, params=params)
 return url

def get_api_url ( base , parts = [ ] , params = None ) : if ( ( 'api' in parts ) and ( parts . index ( 'api' ) != 0 ) ) : parts . pop ( parts . index ( 'api' ) ) parts . insert ( 0 , 'api' ) elif ( 'api' not in parts ) : parts . insert ( 0 , 'api' ) url = util . build_url ( base , pathspec = parts , params = params ) return url
compose and return a url for the tool shed api .