<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ssh(gandi, resource, login, identity, wipe_key, wait, args):
 """Spawn an SSH session to virtual machine. Resource can be a Hostname or an ID """

    if '@' in resource:
        (login, resource) = resource.split('@', 1)
    if wipe_key:
        gandi.iaas.ssh_keyscan(resource)
    if wait:
        gandi.iaas.wait_for_sshd(resource)
    gandi.iaas.ssh(resource, login, identity, args)