def _IntersectTwoHandlers(first_handler, second_handler):
 shared_prefix = _SharedPrefix(first_handler.pattern, second_handler.pattern)
 if shared_prefix:
  return _HandleCommonPrefix(first_handler, second_handler, shared_prefix)
 shared_suffix = _SharedSuffix(first_handler.pattern, second_handler.pattern)
 if shared_suffix:
  return _HandleCommonSuffix(first_handler, second_handler, shared_suffix)
 handler_set = set()
 handler_set |= _HandleWildcardCases(first_handler, second_handler)
 handler_set |= _HandleWildcardCases(second_handler, first_handler)
 handler_set |= set([first_handler, second_handler])
 return handler_set

def _IntersectTwoHandlers ( first_handler , second_handler ) : shared_prefix = _SharedPrefix ( first_handler . pattern , second_handler . pattern ) if shared_prefix : return _HandleCommonPrefix ( first_handler , second_handler , shared_prefix ) shared_suffix = _SharedSuffix ( first_handler . pattern , second_handler . pattern ) if shared_suffix : return _HandleCommonSuffix ( first_handler , second_handler , shared_suffix ) handler_set = set ( ) handler_set |= _HandleWildcardCases ( first_handler , second_handler ) handler_set |= _HandleWildcardCases ( second_handler , first_handler ) handler_set |= set ( [ first_handler , second_handler ] ) return handler_set
returns intersections of first_handler and second_handler patterns .