def method_params(doc):
 doclines = doc.splitlines()
 if ('Args:' in doclines):
  begin = doclines.index('Args:')
  if ('Returns:' in doclines[(begin + 1):]):
   end = doclines.index('Returns:', begin)
   args = doclines[(begin + 1):end]
  else:
   args = doclines[(begin + 1):]
  parameters = []
  for line in args:
   m = re.search('^\\s+([a-zA-Z0-9_]+): (.*)', line)
   if (m is None):
    continue
   pname = m.group(1)
   desc = m.group(2)
   if ('(required)' not in desc):
    pname = (pname + '=None')
   parameters.append(pname)
  parameters = ', '.join(parameters)
 else:
  parameters = ''
 return parameters

def method_params ( doc ) : doclines = doc . splitlines ( ) if ( 'Args:' in doclines ) : begin = doclines . index ( 'Args:' ) if ( 'Returns:' in doclines [ ( begin + 1 ) : ] ) : end = doclines . index ( 'Returns:' , begin ) args = doclines [ ( begin + 1 ) : end ] else : args = doclines [ ( begin + 1 ) : ] parameters = [ ] for line in args : m = re . search ( '^\\s+([a-zA-Z0-9_]+): (.*)' , line ) if ( m is None ) : continue pname = m . group ( 1 ) desc = m . group ( 2 ) if ( '(required)' not in desc ) : pname = ( pname + '=None' ) parameters . append ( pname ) parameters = ', ' . join ( parameters ) else : parameters = '' return parameters
document the parameters of a method .