'Goes through the list of endpoint specifications for the
given type of service and returns a list of endpoint that matches
the given binding. If no binding is given all endpoints available for
that service will be returned.
:param service: The service the endpoint should support
:param binding: The expected binding
:return: All the endpoints that matches the given restrictions'

def endpoint(self, service, binding=None, context=None):

    spec = []
    unspec = []
    endps = self.getattr('endpoints', context)
    if (endps and (service in endps)):
        for endpspec in endps[service]:
            try:
                (endp, bind) = endpspec
                if ((binding is None) or (bind == binding)):
                    spec.append(endp)
            except ValueError:
                unspec.append(endpspec)
    if spec:
        return spec
    else:
        return unspec
