def METHOD_NAME(img, image_type, resolution=None, offset=None, hostname='localhost'):
  from cloudvolume.volumecutout import VolumeCutout
  if type(img) == VolumeCutout:
    try:
      img.dataset_name # check if it's an intact VolumeCutout
      return img
    except AttributeError:
      pass
  resolution = getresolution(img, resolution)
  offset = getoffset(img, offset)
  return VolumeCutout(
    buf=img,
    path=ExtractedPath('mem', hostname, '/', '', '', '', ''),
    cloudpath='IN MEMORY',
    resolution=resolution,
    mip=-1,
    layer_type=image_type,
    bounds=Bbox( offset, offset + Vec(*(img.shape[:3])) ),
    handle=None,
  )