<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(gandi, resource, csr, private_key, country, state, city, organisation, branch, altnames, dcv_method):
 """ Update a certificate CSR. Resource can be a CN or an ID """

    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]

    result = gandi.certificate.update(id_, csr, private_key, country, state,
                                      city, organisation, branch, altnames,
                                      dcv_method)

    gandi.echo('The certificate update operation is %s' % result['id'])
    gandi.echo('You can follow it with:')
    gandi.echo('$ gandi certificate follow %s' % result['id'])
    gandi.echo('When the operation is DONE, you can retrieve the .crt'
               ' with:')
    gandi.echo('$ gandi certificate export "%s"' % resource)

    return result