def contains_function(a, problem_name): for line in a.body: if type(line) == ast.FunctionDef and line.name == problem_name: return True return False