code: def get_system_state(instance_id, region=DEFAULT_REGION):
      """
      Returns health checks state for instances
      :param instance_id: Instance ID to be queried
      :param region: Region where query will be performed
      :return: <tuple> System state and Instance state of instance with matching instance ID
      """
      if not instance_id:
          raise Exception("No instance id provided")
      client = boto3.Session(region_name=region).client("ec2")
      response = client.describe_instance_status(
          InstanceIds=[instance_id]
      )
      if not response:
          raise Exception(
              "Unable to launch the instance. \
                           Did not return any reservations object"
          )
      instance_status_list = response["InstanceStatuses"]
      if not instance_status_list:
          raise Exception(
              "Unable to launch the instance. \
                           Did not return any reservations object"
          )
      if len(instance_status_list) < 1:
          raise Exception(
              "The instance id seems to be incorrect {}. \
                           reservations seems to be empty".format(
                  instance_id
              )
          )
  
      instance_status = instance_status_list[0]
      return (
          instance_status["SystemStatus"]["Status"],
          instance_status["InstanceStatus"]["Status"],
      )
  
imports: import boto3
  import os
  import time
  import re
  from inspect import signature
  import random
  from retrying import retry
  from fabric2 import Connection
  from botocore.config import Config
  from botocore.exceptions import ClientError
  from invoke import run
  from invoke.context import Context
  from .None import DEFAULT_REGION, LOGGER
label_desc: Use image node_id 11 for calling a global function with example usage: get_system_state(instance_id, region) and returns: instance_status,  instance_status