code: def _check_value_recursively(key, val, haystack):
      
      if isinstance(haystack, list):
          return any([_check_value_recursively(key, val, l) for l in haystack])
      elif isinstance(haystack, dict):
          if not key in haystack:
              return any([_check_value_recursively(key, val, d) for k, d in haystack.items()
                          if isinstance(d, list) or isinstance(d, dict)])
          else:
              return haystack[key] == val
      else:
          return False
docs: Check if there is key _key_ with value _val_ in the given dictionary.
      ..warning:
          This is geared at JSON dictionaries, so some corner cases are ignored,
          we assume all iterables are either arrays or dicts