code: def catalog_item_to_offer(
      backend: BackendType,
      item: gpuhunt.CatalogItem,
      requirements: Optional[Requirements],
  ) -> InstanceOffer:
      gpus = []
      if item.gpu_count > 0:
          gpus = [
              Gpu(
                  name=item.gpu_name,
                  memory_mib=round(item.gpu_memory * 1024),
              )
          ] * item.gpu_count
      disk_size_mib = round(
          item.disk_size * 1024
          if item.disk_size
          else requirements.disk.size_mib
          if requirements
          and requirements.disk
          and requirements.disk.size_mib
          else 102400  # TODO: Make requirements' fields required
      )
      resources = Resources(
          cpus=item.cpu,
          memory_mib=round(item.memory * 1024),
          gpus=gpus,
          spot=item.spot,
          disk=Disk(size_mib=disk_size_mib),
      )
      resources.description = resources.pretty_format()
      return InstanceOffer(
          backend=backend,
          instance=InstanceType(
              name=item.instance_name,
              resources=resources,
          ),
          region=item.location,
          price=item.price,
      )
  
file_path: dstack/src/dstack/_internal/core/backends/base/offers.py
imports: from dataclasses import asdict
  from typing import Callable, List, Optional
  import gpuhunt
  from dstack._internal.core.models.backends.base import BackendType
  from dstack._internal.core.models.instances import Disk, Gpu, InstanceOffer, InstanceType, Resources
  from dstack._internal.core.models.runs import Requirements
label_desc: Use image node_id 2 for calling a global function with example usage: catalog_item_to_offer(backend, item, requirements) and returns: InstanceOffer