code: def change_dcv(gandi, resource, dcv_method):
      
      ids = gandi.certificate.usable_ids(resource)
  
      if len(ids) > 1:
          gandi.echo('Will not update, %s is not precise enough.' % resource)
          gandi.echo('  * cert : ' +
                     '\n  * cert : '.join([str(id_) for id_ in ids]))
          return
  
      id_ = ids[0]
  
      opers = gandi.oper.list({'cert_id': id_})
      if not opers:
          gandi.echo('Can not find any operation for this certificate.')
          return
  
      oper = opers[0]
      if (oper['step'] != 'RUN'
              and oper['params']['inner_step'] != 'comodo_oper_updated'):
          gandi.echo('This certificate operation is not in the good step to '
                     'update the DCV method.')
          return
  
      gandi.certificate.change_dcv(oper['id'], dcv_method)
      cert = gandi.certificate.info(id_)
  
      csr = oper['params']['csr']
      package = cert['package']
      altnames = oper['params'].get('altnames')
      gandi.certificate.advice_dcv_method(csr, package, altnames, dcv_method,
                                          cert_id=id_)
docs: Change the DCV for a running certificate operation.
  
      Resource can be a CN or an ID