input: Write a function to create and manage an Environment object capable of executing and analyzing Python code. The Environment includes a set of predefined global variables and functions, which can also be extended by user-defined globals. The created environment can execute Python code, analyze it for variable usage and imports, and capture the output through a stdout object. The environment should also support methods to initialize commands based on the filesystem's state, fix up global variables, perform code execution with optional subexpression handling, and perform code analysis.
  
  
  class Environment:
      @staticmethod
      def initialize(path: str) -> 'Environment':
          pass
  
      @staticmethod
      def execute(filename: str, content: str, subexpressions: bool = False) -> None:
          pass
  
      @staticmethod
      def analyze(filename: str, content: str) -> None:
          pass
  
  assert isinstance(Environment.initialize('test_path'), Environment)
  assert isinstance(Environment.execute("test.py", "print('Hello')", False), NoneType)
  assert isinstance(Environment.analyze("test.py", "import os\nprint(os.getcwd())"), NoneType)
  
output: class Environment:
      @staticmethod
      def initialize(path: str) -> 'Environment':
          env = Environment()
          env.globals = {}
          env.stdout = []
          return env
  
      @staticmethod
      def execute(filename: str, content: str, subexpressions: bool = False) -> None:
          env = Environment.initialize('')
          exec(content, env.globals)
          if subexpressions:
              for line in content.splitlines():
                  exec(line, env.globals)
  
      @staticmethod
      def analyze(filename: str, content: str) -> None:
          env = Environment.initialize('')
          tree = ast.parse(content)
          for node in ast.walk(tree):
              if isinstance(node, ast.Import):
                  for n in node.names:
                      print(f"Imported module: {n.name}")
              elif isinstance(node, ast.ImportFrom):
                  print(f"Imported from module: {node.module}")
              elif isinstance(node, ast.Name):
                  print(f"Variable used: {node.id}")