input: Write a function to create an environment object that can execute and analyze Python code. The environment should include predefined global variables and functions, and the ability to add additional global variables. It should also be able to execute Python code and analyze it for variable usage and imports, capturing and displaying output from executed code. If the given path is empty, the function should return an empty environment.
  assert create_environment("") == {}
  assert isinstance(create_environment("/path/to/code"), Environment)
  assert create_environment("/path/to/code").globals.get("print") == jsonify_print
  assert create_environment("/path/to/code").execute("test.py", "print('Hello')", subexpressions=True)
  assert create_environment("/path/to/code").analyze("test.py", "a = 1 + 2")
output: def create_environment(path):
      if not path:
          return {}
      
      class Environment:
          def __init__(self):
              self.globals = {"print": jsonify_print}
          
          def execute(self, filename, code, subexpressions=False):
              exec(code, self.globals)
              return True
          
          def analyze(self, filename, code):
              tree = ast.parse(code)
              for node in ast.walk(tree):
                  if isinstance(node, ast.Import):
                      for alias in node.names:
                          print(f"Imported: {alias.name}")
                  elif isinstance(node, ast.Assign):
                      for target in node.targets:
                          print(f"Assigned: {target.id}")
              return True
      
      return Environment()