def METHOD_NAME(api_callable=None,cmd_callable=None): # this should probably be the __init__ method of myoptionparser
    def getdefaulttag(default):
        if default is not None: return " [Default: %default]"
        return ''
    def get_arguments_and_options(callable):
        """Infers and returns arguments and options based on a callable's signature.
        Cooperates with decorator @describe"""
	try:
        	funcargs = inspect.getargspec(callable).args
        	defaults = inspect.getargspec(callable).defaults
	except:
		funcargs = inspect.getargspec(callable)[0]
        	defaults = inspect.getargspec(callable)[3]
        if not defaults: defaults = []
        args = funcargs[1:len(funcargs)-len(defaults)] # this assumes self, so assumes methods
        opts = funcargs[len(funcargs)-len(defaults):]
        try: descriptions = callable.descriptions
        except AttributeError: descriptions = {}
        arguments = [ (argname, descriptions.get(argname,'') ) for argname in args ]
        options = [ [
                          ("--%s"%argname.replace("_","-"),),
                          {
                           "dest":argname,
                           "help":descriptions.get(argname,'') + getdefaulttag(default),
                           "default":default,
                          }
                        ] for argname,default in zip(opts,defaults) ]
        return arguments,options
    basic_usage = "usage: %prog [options...] "
    api_name = "<api>"
    cmd_name = "<command>"
    description = "%prog is a command-line tool to access several cloud APIs."
    arguments = ''
    argexp = ""
    if api_callable:
        api_name = api_callable.__module__.split(".")[-1].replace("_","-")
        api_arguments,api_options = get_arguments_and_options(api_callable)
        assert len(api_arguments) is 0 # no mandatory arguments for class initializers
    if cmd_callable:
        cmd_name = cmd_callable.__name__.replace("_","-")
        cmd_arguments,cmd_options = get_arguments_and_options(cmd_callable)
        if cmd_arguments:
            arguments   = " " + " ".join( [ s[0].upper() for s in cmd_arguments ] )
            argexp = "\n\nArguments:\n" + "\n".join ( "  %s\n                        %s"%(s.upper(),u) for s,u in cmd_arguments )
        description = cmd_callable.__doc__
    api_command = "%s %s"%(api_name,cmd_name)
    if description: description = "\n\n" + description
    else: description = ''
    usage = basic_usage + api_command + arguments + description + argexp
    parser = MyOptionParser(usage=usage, add_help_option=False)
    parser.add_option('--help', action="help")
    group = parser.add_option_group("General options")
    group.add_option('-v', '--verbose', dest="verbose", help="Print extra output")
    parser.api_dests = []
    if api_callable and api_options:
        group = parser.add_option_group("Options for the %s API"%api_name)
        for a in api_options:
            group.add_option(a[0][0],**a[1])
            parser.api_dests.append(a[1]["dest"])
    parser.cmd_dests = []
    if cmd_callable and cmd_options:
        group = parser.add_option_group("Options for the %s command"%cmd_name)
        for a in cmd_options:
            group.add_option(a[0][0],**a[1])
            parser.cmd_dests.append(a[1]["dest"])
    return parser