docs: def find_endpoint(url=None, eid=None, selector=None, cid=None, nid=None, local_cache=True):
          """
          find endpoint according to endpoint url or endpoint ID. if both are defined then search will focus on ID only
          :param url: endpoint's url
          :param eid: endpoint id
          :param selector: endpoint selector like endpointURL =~ '.*tcp.*'
          :param cid: define research context with container id.
          Returned endpoints are owned by the container with id = cid
          :param nid: define research context with node id. Returned endpoints are owned by the node with id = nid
          :param local_cache: define if returned unit(*) result should be cached as a local entity
          and then removed from cache when endpoint.remove() is called.
          (*) endpoints set results are not cached
          :return: the endpoint if found or None if not found
          """
          LOGGER.debug("EndpointService.find_endpoint")
          ret = None
          if (eid is None or not eid) and (url is None or not url) and (selector is None or not selector):
              raise exceptions.ArianeCallParametersError('id, endpoint_url and selector')
  
          if (eid is not None and eid) and ((url is not None and url) or (selector is not None and selector)):
              LOGGER.debug('EndpointService.find_endpoint - '
                           'Both id and (endpoint url or selector) are defined. Will give you search on id.')
              # traceback.print_stack()
              url = None
              selector = None
  
          if (url is not None and url) and (selector is not None and selector):
              LOGGER.warning('EndpointService.find_endpoint - '
                             'Both endpoint url and selector are defined. Will give you search on url.')
              # traceback.print_stack()
              selector = None
  
          params = None
          search_params = None
          mapping_service_call = False
          return_set_of_endpoints = False
          if eid is not None and eid:
              search_params = {'ID': eid}
              params = SessionService.complete_transactional_req({'ID': eid})
              if MappingService.driver_type != DriverFactory.DRIVER_REST:
                  params['OPERATION'] = 'getEndpoint'
          elif url is not None and url:
              search_params = {'URL': url}
              params = SessionService.complete_transactional_req({'URL': url})
              if MappingService.driver_type != DriverFactory.DRIVER_REST:
                  params['endpointURL'] = url
                  params['OPERATION'] = 'getEndpointByURL'
          elif selector is not None and selector:
              if cid is None and nid is None:
                  search_params = {'selector': selector}
                  params = SessionService.complete_transactional_req({'selector': selector})
                  if MappingService.driver_type != DriverFactory.DRIVER_REST:
                      params['OPERATION'] = 'getEndpoints'
              else:
                  if nid is not None and nid:
                      search_params = {'nodeID': nid, 'selector': selector}
                      params = SessionService.complete_transactional_req({'nodeID': nid, 'selector': selector})
                      if MappingService.driver_type != DriverFactory.DRIVER_REST:
                          params['OPERATION'] = 'getEndpointsBySelector'
                          mapping_service_call = True
                  elif cid is not None and cid:
                      search_params = {'containerID': cid, 'selector': selector}
                      params = SessionService.complete_transactional_req({'containerID': cid, 'selector': selector})
                      if MappingService.driver_type != DriverFactory.DRIVER_REST:
                          params['OPERATION'] = 'getEndpointsBySelector'
                          mapping_service_call = True
              return_set_of_endpoints = True
  
          if params is not None:
              if str(search_params) in EndpointService.local_cache_by_params.keys():
                  ret = EndpointService.local_cache_by_params[str(search_params)]
              else:
                  if MappingService.driver_type != DriverFactory.DRIVER_REST:
                      args = {'properties': params}
                  else:
                      args = {'http_operation': 'GET', 'operation_path': 'get', 'parameters': params}
  
                  if mapping_service_call:
                      response = MappingService.requester.call(args)
                  else:
                      response = EndpointService.requester.call(args)
  
                  if MappingService.driver_type != DriverFactory.DRIVER_REST:
                      response = response.get()
  
                  if response.rc == 0:
                      if return_set_of_endpoints:
                          ret = []
                          for endpoint in response.response_content['endpoints']:
                              ep = Endpoint.json_2_endpoint(endpoint)
                              ret.append(ep)
                              if local_cache:
                                  if ep.id not in EndpointService.local_cache_by_id:
                                      EndpointService.local_cache_by_id[ep.id] = []
                                  eid_search_params = {'ID': ep.id}
                                  EndpointService.local_cache_by_params[str(eid_search_params)] = ep
                                  EndpointService.local_cache_by_id[ep.id].append(str(eid_search_params))
                      else:
                          ret = Endpoint.json_2_endpoint(response.response_content)
                          if local_cache:
                              if ret.id not in EndpointService.local_cache_by_id.keys():
                                  EndpointService.local_cache_by_id[ret.id] = []
                              EndpointService.local_cache_by_params[str(search_params)] = ret
                              EndpointService.local_cache_by_id[ret.id].append(str(search_params))
                              if eid is None or not eid:
                                  eid_search_params = {'ID': ret.id}
                                  EndpointService.local_cache_by_params[str(eid_search_params)] = ret
                                  EndpointService.local_cache_by_id[ret.id].append(str(eid_search_params))
  
                  elif response.rc != 404:
                      err_msg = 'EndpointService.find_endpoint - Problem while searching endpoint (id:' + \
                                str(eid) + ', primary admin gate url: ' + str(url) + ', selector: ' + str(selector) + \
                                ', cid: ' + str(cid) + ', nid: ' + str(nid) + '). ' + \
                                'Reason: ' + str(response.response_content) + ' - ' + str(response.error_message) + \
                                " (" + str(response.rc) + ")"
                      LOGGER.warning(err_msg)
                      if response.rc == 500 and ArianeMappingOverloadError.ERROR_MSG in response.error_message:
                          raise ArianeMappingOverloadError("EndpointService.find_endpoint",
                                                           ArianeMappingOverloadError.ERROR_MSG)
                      # traceback.print_stack()
  
          return ret