def svc_defs(svcs=None, op=None):
    """Returns service definitions for service name(s)
    @param svcs name or list of names of service
    """
    from pyon.core.bootstrap import get_service_registry

    if not getattr(svcs, '__iter__', False) and op is not None:
        svcdef = get_service_registry().services[svcs]
        print "Service definition for: %s (version %s) operation %s" % (svcs, svcdef.version or 'ND', op)
        print "".join([str(o) for o in svcdef.operations if o.name == op])
        return svcdef

    elif svcs is not None:
        if not getattr(svcs, '__iter__', False):
            svcs = (svcs,)
        for svcname in svcs:
            svcdef = get_service_registry().services[svcname]
            svcops = "\n     ".join(sorted([o.name for o in svcdef.operations]))
            print "Service definition for: %s (version %s)" % (svcname, svcdef.version or 'ND')
            print "ops: %s" % (svcops)
            return svcdef

    else:
        print "List of defined services"
        print "------------------------"

        for svcname in sorted(get_service_registry().services.keys()):
            svcdef = get_service_registry().services[svcname]
            print "%s %s" % (svcname, svcdef.version)

        print "\nType svc_defs('name') or svc_defs(['name1','name2']) for definition"
        return None
dataset/ETHPy150Open ooici/pyon/pyon/container/shell_api.py/svc_defs/original