code: def snapshot(gandi, name, resource, background):
      
      name = name or randomstring('snp')
  
      source_info = gandi.disk.info(resource)
      datacenter = source_info['datacenter_id']
      result = gandi.disk.create(name, None, None, None, datacenter, resource,
                                 'snapshot', background)
  
      if background:
          gandi.pretty_echo(result)
      return result
docs: Create a snapshot on the fly.