code: def list_commands(self, **kwargs):
          
          commands = self._commands
  
          command_id = kwargs.get('CommandId', None)
          if command_id:
              commands = [self.get_command_by_id(command_id)]
          instance_id = kwargs.get('InstanceId', None)
          if instance_id:
              commands = self.get_commands_by_instance_id(instance_id)
  
          return {
              'Commands': [command.response_object() for command in commands]
          }
docs: https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_ListCommands.html