  def _GetInstanceType(
      self,
      cpu_cores: int,
      memory_in_mb: int,
      premium_io: bool = False,
      region: Optional[str] = None) -> str:
    """Returns an instance type for the given number of CPU cores / memory.

    Args:
      cpu_cores (int): The number of CPU cores.
      memory_in_mb (int): The amount of memory (in MB).
      premium_io (bool): Whether or not it requires the ability to support
        Premium IO storage (default False).
      region (str): Optional. The region in which to create the disk. If not
          provided, the disk will be created in the default_region associated to
          the AZAccount object.

    Returns:
      str: The instance type for the given configuration.

    Raises:
      ValueError: If no instance type matches the requested configuration.
    """
    if region is None:
      region = self.az_account.default_region
    vm_sizes = self.ListInstanceTypes(region=region)
    family_quotas = {}
    for size in vm_sizes:
      if size['CPU'] == cpu_cores and size['Memory'] == memory_in_mb:
        if premium_io is True and size['PremiumIO'] is False:
          continue
        if size['Family'] not in family_quotas:
          family_quotas[size['Family']] = False
          logger.info('Fetching quota for family {0!s}'.format(size['Family']))
          quota_response = self.quota_client.quota.get(
              subscription_id=self.az_account.subscription_id,
              provider_id='Microsoft.Compute',
              location=region,
              resource_name=size['Family'])
          if quota_response.properties is not None and \
            quota_response.properties.limit is not None and \
            quota_response.properties.current_value is not None:
            family_quotas[size['Family']] = (
                quota_response.properties.limit > 0) and (
                    quota_response.properties.current_value
                    < quota_response.properties.limit)
          if not family_quotas[size['Family']]:
            continue
        instance_type = size['Name']  # type: str
        logger.info('Selected Instance Type: {0!s}'.format(size))
        return instance_type
    raise ValueError(
        'No instance type found for the requested configuration: {0:d} CPU '
        'cores, {1:d} MB memory, Premium IO: {2!s}.'.format(
            cpu_cores, memory_in_mb, premium_io))
Returns an instance type for the given number of CPU cores / memory.

Args:
cpu_cores (int): The number of CPU cores.
memory_in_mb (int): The amount of memory (in MB).
premium_io (bool): Whether or not it requires the ability to support
Premium IO storage (default False).
region (str): Optional. The region in which to create the disk. If not
provided, the disk will be created in the default_region associated to
the AZAccount object.

Returns:
str: The instance type for the given configuration.

Raises:
ValueError: If no instance type matches the requested configuration.
libcloudforensics/providers/azure/internal/compute.py