How would you analyze a Python code snippet and suggest a better structure?
Implement the function below using Python's ast module. Return the defined function names, the number of executable top-level statements, detected structural issues, and one refactoring suggestion. Count a function as long when it has more than eight direct body statements, and flag nesting depth of three or more for loops, conditionals, exception handlers, or context managers.
Input is valid Python source code. Return the result as a dictionary with keys functions, top_level_statements, issues, and suggestion.
def analyze_python_structure(code):