def contains_at_depth(haystack, needle, n):
 if (not hasattr(haystack, '__iter__')):
  return False
 if (n == 0):
  return (needle in haystack)
 else:
  for item in haystack:
   if contains_at_depth(item, needle, (n - 1)):
    return True
  return False

def contains_at_depth ( haystack , needle , n ) : if ( not hasattr ( haystack , '__iter__' ) ) : return False if ( n == 0 ) : return ( needle in haystack ) else : for item in haystack : if contains_at_depth ( item , needle , ( n - 1 ) ) : return True return False
is the needle in haystack at depth n? return true if the needle is present in one of the sub-iterables in haystack at depth n .