  def GetInstancesByName(self,
                         instance_name: str,
                         region: Optional[str] = None) -> List[AWSInstance]:
    """Get all instances from an AWS account with matching name tag.

    Args:
      instance_name (str): The instance name tag.
      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:
      List[AWSInstance]: A list of EC2 Instance objects. If no instance with
          matching name tag is found, the method returns an empty list.
    """

    instances = self.ListInstances(region=region)
    return [instance for instance in instances.values() if
            instance.name == instance_name]
Get all instances from an AWS account with matching name tag.

Args:
instance_name (str): The instance name tag.
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:
List[AWSInstance]: A list of EC2 Instance objects. If no instance with
matching name tag is found, the method returns an empty list.
libcloudforensics/providers/aws/internal/ec2.py