code: def get_instance_state(self, instances=None):
          
          if instances:
              desc = self.client.describe_instances(InstanceIds=instances)
          else:
              desc = self.client.describe_instances(InstanceIds=self.instances)
          # pprint.pprint(desc['Reservations'],indent=4)
          for i in range(len(desc['Reservations'])):
              instance = desc['Reservations'][i]['Instances'][0]
              self.instance_states[instance['InstanceId']] = instance['State']['Name']
          return self.instance_states
docs: Get states of all instances on EC2 which were started by this file.