def deactivate_mfa_device(user_name, serial, region=None, key=None, keyid=None, profile=None):
 user = get_user(user_name, region, key, keyid, profile)
 if (not user):
  msg = 'Username {0} does not exist'
  log.error(msg.format(user_name))
  return False
 conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
 try:
  conn.deactivate_mfa_device(user_name, serial)
  log.info('Deactivated MFA device {1} for user {0}.'.format(user_name, serial))
  return True
 except boto.exception.BotoServerError as e:
  log.debug(e)
  if ('Not Found' in e):
   log.info('MFA device {1} not associated with user {0}.'.format(user_name, serial))
   return True
  msg = 'Failed to deactivate MFA device {1} for user {0}.'
  log.error(msg.format(user_name, serial))
  return False

def deactivate_mfa_device ( user_name , serial , region = None , key = None , keyid = None , profile = None ) : user = get_user ( user_name , region , key , keyid , profile ) if ( not user ) : msg = 'Username {0} does not exist' log . error ( msg . format ( user_name ) ) return False conn = _get_conn ( region = region , key = key , keyid = keyid , profile = profile ) try : conn . deactivate_mfa_device ( user_name , serial ) log . info ( 'Deactivated MFA device {1} for user {0}.' . format ( user_name , serial ) ) return True except boto . exception . BotoServerError as e : log . debug ( e ) if ( 'Not Found' in e ) : log . info ( 'MFA device {1} not associated with user {0}.' . format ( user_name , serial ) ) return True msg = 'Failed to deactivate MFA device {1} for user {0}.' log . error ( msg . format ( user_name , serial ) ) return False
deactivates the specified mfa device and removes it from association with the user .