def _generate_url(arg, stable):
 url = BASE_URL
 if stable:
  url += 'stable/'
 else:
  url += 'devel/'
 if (arg is None):
  return url
 elif (type(arg) is str):
  url += 'search.html?'
  url += urlencode({'q': arg})
  url += '&check_keywords=yes&area=default'
 else:
  try:
   func = arg
   func_name = func.__name__
   func_module = func.__module__
   if (not func_module.startswith('statsmodels.')):
    return ValueError('Function must be from statsmodels')
   url += 'generated/'
   url += (((func_module + '.') + func_name) + '.html')
  except:
   return ValueError('Input not understood')
 return url

def _generate_url ( arg , stable ) : url = BASE_URL if stable : url += 'stable/' else : url += 'devel/' if ( arg is None ) : return url elif ( type ( arg ) is str ) : url += 'search.html?' url += urlencode ( { 'q' : arg } ) url += '&check_keywords=yes&area=default' else : try : func = arg func_name = func . __name__ func_module = func . __module__ if ( not func_module . startswith ( 'statsmodels.' ) ) : return ValueError ( 'Function must be from statsmodels' ) url += 'generated/' url += ( ( ( func_module + '.' ) + func_name ) + '.html' ) except : return ValueError ( 'Input not understood' ) return url
parse inputs and return a correctly formatted url or an error if the input is not understandable .