def check_modify_host_locking(host, update_data):
 locked = update_data.get('locked', None)
 if (locked is not None):
  if (locked and host.locked):
   raise model_logic.ValidationError({'locked': ('Host already locked by %s on %s.' % (host.locked_by, host.lock_time))})
  if ((not locked) and (not host.locked)):
   raise model_logic.ValidationError({'locked': 'Host already unlocked.'})

def check_modify_host_locking ( host , update_data ) : locked = update_data . get ( 'locked' , None ) if ( locked is not None ) : if ( locked and host . locked ) : raise model_logic . ValidationError ( { 'locked' : ( 'Host already locked by %s on %s.' % ( host . locked_by , host . lock_time ) ) } ) if ( ( not locked ) and ( not host . locked ) ) : raise model_logic . ValidationError ( { 'locked' : 'Host already unlocked.' } )
checks when locking/unlocking has been requested if the host is already locked/unlocked .