code: def run_commands(commands,  # type: List[Union[str, List[str], Dict[str, Union[str, List[str]]]]]
                   directory,  # type: str
                   env=None  # type: Optional[Dict[str, Union[str, int]]]
                  ):  # noqa
      # type: (...) -> None
      
      if env is None:
          env = os.environ.copy()
      for step in commands:
          if isinstance(step, (list, six.string_types)):
              execution_dir = directory
              raw_command = step
          elif step.get('command'):  # dictionary
              execution_dir = os.path.join(directory,
                                           step.get('cwd')) if step.get('cwd') else directory  # noqa pylint: disable=line-too-long
              raw_command = step['command']
          else:
              raise AttributeError("Invalid command step: %s" % step)
          command_list = raw_command.split(' ') if isinstance(raw_command, six.string_types) else raw_command  # noqa pylint: disable=line-too-long
          if platform.system().lower() == 'windows':
              command_list = fix_windows_command_list(command_list)
  
          with change_dir(execution_dir):
              check_call(command_list, env=env)
docs: Run list of commands.