<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def FailoverInstance(r, instance, iallocator=None, ignore_consistency=False, target_node=None):
 """Does a failover of an instance. @type instance: string @param instance: Instance name @type iallocator: string @param iallocator: Iallocator for deciding the target node for shared-storage instances @type ignore_consistency: bool @param ignore_consistency: Whether to ignore disk consistency @type target_node: string @param target_node: Target node for shared-storage instances @rtype: string @return: job id """


    body = {
        "ignore_consistency": ignore_consistency,
    }

    if iallocator is not None:
        body["iallocator"] = iallocator
    if target_node is not None:
        body["target_node"] = target_node


    return r.request("put", "/2/instances/%s/failover" % instance,
                     content=body)