def format_function(name, function, docstring=None):
 template = '.. py:function:: ckan.plugins.toolkit.{function}{args}\n\n{docstring}\n\n'
 argstring = inspect.formatargspec(*inspect.getargspec(function))
 docstring = (docstring or inspect.getdoc(function))
 if (docstring is None):
  docstring = ''
 else:
  docstring = '\n'.join([('   ' + line) for line in docstring.split('\n')])
 return template.format(function=name, args=argstring, docstring=docstring)

def format_function ( name , function , docstring = None ) : template = '.. py:function:: ckan.plugins.toolkit.{function}{args}\n\n{docstring}\n\n' argstring = inspect . formatargspec ( * inspect . getargspec ( function ) ) docstring = ( docstring or inspect . getdoc ( function ) ) if ( docstring is None ) : docstring = '' else : docstring = '\n' . join ( [ ( '   ' + line ) for line in docstring . split ( '\n' ) ] ) return template . format ( function = name , args = argstring , docstring = docstring )
return a sphinx .