  def GetVolumesByNameOrId(self,
                           volume_name: Optional[str] = None,
                           volume_id: Optional[str] = None,
                           region: Optional[str] = None) -> List[AWSVolume]:
    """Get a volume from an AWS account by its name tag or its ID.

    Exactly one of [volume_name, volume_id] must be specified. If looking up
    a volume by its ID, the method returns a list with exactly one
    element. If looking up volumes by their name tag (which are not unique
    across volumes), then the method will return a list of all volumes
    with that name tag, or an empty list if no volumes with matching name tag
    could be found.

    Args:
      volume_name (str): Optional. The volume name tag of the volume to get.
      volume_id (str): Optional. The volume id of the volume to get.
      region (str): Optional. The region to look the volume in.
          If none provided, the default_region associated to the AWSAccount
          object will be used.

    Returns:
      List[AWSVolume]: A list of Amazon EC2 Volume objects.

    Raises:
      ValueError: If both volume_name and volume_id are None or if both
          are set.
    """

    if (not volume_name and not volume_id) or (volume_name and volume_id):
      raise ValueError('You must specify exactly one of [volume_name, '
                       'volume_id]. Got volume_name: {0:s}, volume_id: '
                       '{1:s}'.format(str(volume_name), str(volume_id)))
    if volume_name:
      return self.GetVolumesByName(volume_name, region=region)
    # mypy complains that volume_id may be None here, but at this point in the
    # code it never is, so it's safe to ignore the warning.
    return [self.GetVolumeById(volume_id, region=region)]  # type: ignore
Get a volume from an AWS account by its name tag or its ID.

Exactly one of [volume_name, volume_id] must be specified. If looking up
a volume by its ID, the method returns a list with exactly one
element. If looking up volumes by their name tag (which are not unique
across volumes), then the method will return a list of all volumes
with that name tag, or an empty list if no volumes with matching name tag
could be found.

Args:
volume_name (str): Optional. The volume name tag of the volume to get.
volume_id (str): Optional. The volume id of the volume to get.
region (str): Optional. The region to look the volume in.
If none provided, the default_region associated to the AWSAccount
object will be used.

Returns:
List[AWSVolume]: A list of Amazon EC2 Volume objects.

Raises:
ValueError: If both volume_name and volume_id are None or if both
are set.
libcloudforensics/providers/aws/internal/ebs.py