  def _GenerateVolumeName(self,
                          snapshot: AWSSnapshot,
                          volume_name_prefix: Optional[str] = None) -> str:
    """Generate a new volume name given a volume's snapshot.

    Args:
      snapshot (AWSSnapshot): A volume's Snapshot.
      volume_name_prefix (str): Optional. Prefix for the volume name.

    Returns:
      str: A name for the volume.

    Raises:
      ValueError: If the volume name does not comply with the RegEx,
          or if AWS account information could not be retrieved.
    """

    # Max length of tag values in AWS is 255 characters
    user_id = self.GetAccountInformation().get('UserId')
    if not user_id:
      raise ValueError('Could not fetch AWS user ID')
    volume_id = user_id + snapshot.volume.volume_id
    volume_id_crc32 = '{0:08x}'.format(
        binascii.crc32(volume_id.encode()) & 0xffffffff)
    truncate_at = 255 - len(volume_id_crc32) - len('-copy') - 1
    if not snapshot.name:
      snapshot.name = snapshot.snapshot_id
    if volume_name_prefix:
      volume_name_prefix += '-'
      if len(volume_name_prefix) > truncate_at:
        # The volume name prefix is too long
        volume_name_prefix = volume_name_prefix[:truncate_at]
      truncate_at -= len(volume_name_prefix)
      volume_name = '{0:s}{1:s}-{2:s}-copy'.format(
          volume_name_prefix,
          snapshot.name[:truncate_at],
          volume_id_crc32)
    else:
      volume_name = '{0:s}-{1:s}-copy'.format(
          snapshot.name[:truncate_at], volume_id_crc32)

    return volume_name
Generate a new volume name given a volume's snapshot.

Args:
snapshot (AWSSnapshot): A volume's Snapshot.
volume_name_prefix (str): Optional. Prefix for the volume name.

Returns:
str: A name for the volume.

Raises:
ValueError: If the volume name does not comply with the RegEx,
or if AWS account information could not be retrieved.
libcloudforensics/providers/aws/internal/ebs.py