def restart_vm(uid, method, context):
    """
    Restarts a VM.
      OS types == SOFT, HARD
      OCCI -> graceful, warm and cold
      mapping:
      - SOFT -> graceful, warm
      - HARD -> cold

    uid -- id of the instance
    method -- how the machine should be restarted.
    context -- the os context
    """
    instance = get_vm(uid, context)

    if ('graceful', 'warm') in method:
        reboot_type = 'SOFT'
    elif method == 'cold':
        reboot_type = 'HARD'
    else:
        raise AttributeError('Unknown method.')
    try:
        COMPUTE_API.reboot(context, instance, reboot_type)
    except Exception as e:
        raise AttributeError(e.message)
dataset/ETHPy150Open tmetsch/occi-os/occi_os_api/nova_glue/vm.py/restart_vm/swapped operands of `in`