def _IsIn(matcher, value, operand):
  """Applies matcher to determine if value matches/contains operand.

  Both value and operand can be lists.

  Args:
    matcher: Boolean match function that takes value as an argument and
      returns True if the value matches/contains the expression operand.
    value: The key value or list of values.
    operand: Operand value or list of values.

  Returns:
    True if the value (or any element in value if it is a list) matches/contains
    operand (or any element in operand if it is a list).
  """
  values = value if isinstance(value, (dict, list, tuple)) else [value]
  operands = operand if isinstance(operand, (dict, list, tuple)) else [operand]
  for v in values:
    for o in operands:
      if matcher(v, o):
        return True
  return False