import ast


def has_node(code, node):
    """Given an AST or code string returns True if the code contains
    any particular node statement.

    Parameters
    ----------

    code: A code string or the result of an ast.parse.

    node: A node type or tuple of node types to check for.  If a tuple is passed
    it returns True if any one of them is in the code.
    """
    tree = ast.parse(code) if isinstance(code, str) else code
    for n in ast.walk(tree):
        if isinstance(n, node):
            return True
    return False