if exists and machine is None:
raise InvalidInput('machine_id', machine_id, "Does not exist.")
if machine is not None and not haveAccess(user, state, machine):
if exists and machine is None:
raise InvalidInput('machine_id', machine_id, "Does not exist.")
if machine is not None and not haveAccess(user, state, machine):