def help(doc, verbose, *path):

    # Locates the desired object
    # Will try to follow path implicitly (for resources, methods, parameters)
    # otherwise the path must be fully defined (most likely useful for schemas)
    base = doc
    for p in path:
        if p[:2] == '--':
            p = p[2:]
        if p in base:
            base = base[p]
        elif 'resources' in base and p in base['resources']:
            base = base['resources'][p]
        elif 'methods' in base and p in base['methods']:
            base = base['methods'][p]
        elif 'parameters' in base and p in base['parameters']:
            base = base['parameters'][p]
        else:
            n = ('resources' in base) + ('methods' in base) + ('parameters' in base
                                                               and not base == doc)
            while (n == 1 or len(base) == 1) and not p in base:
                i = 0
                if 'resources' in base:
                    i = base.keys().index('resources')
                elif 'methods' in base:
                    i = base.keys().index('methods')
                elif 'parameters' in base:
                    i = base.keys().index('parameters')
                base = base[base.keys()[i]]
                n = ('resources' in base) + \
                    ('methods' in base) + ('parameters' in base)
            if p in base:
                base = base[p]
            else:
                LOG.error('Error in path: "' + p + '" not found')
                return

    # Displays the attributes of the requested object
    # Formatted if object is base API, method, or resource and not verbose.
    if not verbose:
        if isinstance(base, dict):
            if 'version' in base:  # Base API
                print ' ' + base['description']
                print '  Resources: ' + ', '.join(base['resources'])
            elif 'httpMethod' in base:  # Method
                print ' ' + base['description']
                if 'parameterOrder' in base:
                    print '  Requires: ' + ' AND '.join(base['parameterOrder']) \
                        + ' Optional: ' + ', '.join([i for i in base['parameters'] if
                                                     i not in base['parameterOrder']])
                elif 'parameters' in base:
                    print '  Optional: ' + ', '.join(base['parameters'])
                if 'request' in base:
                    print '  Request schema: ' + base['request']['$ref']
            elif 'methods' in base or 'resources' in base:  # Resource
                if 'methods' in base:
                    print '  Methods: ' + ', '.join(base['methods'])
                if 'resources' in base:
                    print '  Resources: ' + ', '.join(base['resources'])
            else:  # Everything else
                for obj in base:
                    if isinstance(base[obj], dict) or isinstance(base[obj], list):
                        print '  ' + obj + ": " + ', '.join(base[obj])
                    else:
                        print '  ' + obj + ": " + str(base[obj])
        else:
            print base
    else:
        if isinstance(base, dict):
            for obj in base:
                if isinstance(base[obj], dict) or isinstance(base[obj], list):
                    print '  ' + obj + ": " + ', '.join(base[obj])
                else:
                    print '  ' + obj + ": " + str(base[obj])
        else:
            print base
Prints the help for an arbitrary service
dataset/ETHPy150Open vinitkumar/googlecl/src/googlecl/discovery/docs.py/help