def search_complex_type(stmt, name):
    """Searches for a complex-type in the scope of stmt."""
    while stmt is not None:
        if name in stmt.i_complex_types:
            return stmt.i_complex_types[name]
        stmt = stmt.parent
    return None