import ast


def get_dependencies_from_ast(tree):
    """Return list with imported modules found in tree."""
    imports = []
    for node in ast.walk(tree):
        if isinstance(node, ast.Import):
            for name in node.names:
                imports.append(name.name)
        if isinstance(node, ast.ImportFrom):
            imports.append(node.module)
    return imports