  def GetInstanceById(self,
                      instance_id: str,
                      region: Optional[str] = None) -> AWSInstance:
    """Get an instance from an AWS account by its ID.

    Args:
      instance_id (str): The instance id.
      region (str): Optional. The region to look the instance in.
          If none provided, the default_region associated to the AWSAccount
          object will be used.

    Returns:
      AWSInstance: An Amazon EC2 Instance object.

    Raises:
      ResourceNotFoundError: If instance does not exist.
    """

    instances = self.ListInstances(region=region)
    instance = instances.get(instance_id)
    if not instance:
      raise errors.ResourceNotFoundError(
          'Instance {0:s} was not found in AWS account'.format(instance_id),
          __name__)
    return instance
Get an instance from an AWS account by its ID.

Args:
instance_id (str): The instance id.
region (str): Optional. The region to look the instance in.
If none provided, the default_region associated to the AWSAccount
object will be used.

Returns:
AWSInstance: An Amazon EC2 Instance object.

Raises:
ResourceNotFoundError: If instance does not exist.
libcloudforensics/providers/aws/internal/ec2.py