def BlockdevImage(disk, image, size):
  if not (utils.IsUrl(image) or os.path.exists(image)):
    _Fail("Image '%s' not found", image)

  try:
    rdev = _RecursiveFindBD(disk)
  except errors.BlockDeviceError:
    rdev = None

  if not rdev:
    _Fail("Cannot image device %s: device not found", disk.iv_name)
  if size < 0:
    _Fail("Negative size")
  if size > rdev.size:
    _Fail("Image size is bigger than device size")

  if utils.IsUrl(image):
    _DownloadAndDumpDevice(image, rdev.dev_path, size)
  else:
    _DumpDevice(image, rdev.dev_path, 0, size, False)
Returns dictionary.
dataset/ETHPy150Open ganeti/ganeti/lib/backend.py/BlockdevImage--crossover with--dataset/ETHPy150Open kmadac/bitstamp-python-client/bitstamp/client.py/Public.ticker