def filter_user(user_ref):
 if user_ref:
  user_ref = user_ref.copy()
  user_ref.pop('password', None)
  user_ref.pop('tenants', None)
  user_ref.pop('groups', None)
  user_ref.pop('domains', None)
  try:
   user_ref['extra'].pop('password', None)
   user_ref['extra'].pop('tenants', None)
  except KeyError:
   pass
  if ('password_expires_at' not in user_ref):
   user_ref['password_expires_at'] = None
 return user_ref

def filter_user ( user_ref ) : if user_ref : user_ref = user_ref . copy ( ) user_ref . pop ( 'password' , None ) user_ref . pop ( 'tenants' , None ) user_ref . pop ( 'groups' , None ) user_ref . pop ( 'domains' , None ) try : user_ref [ 'extra' ] . pop ( 'password' , None ) user_ref [ 'extra' ] . pop ( 'tenants' , None ) except KeyError : pass if ( 'password_expires_at' not in user_ref ) : user_ref [ 'password_expires_at' ] = None return user_ref
filter out private items in a user dict .