def validate_user_data(user_data):
 try:
  user_data = base64.b64decode(user_data)
 except TypeError:
  return False
 return True

def validate_user_data ( user_data ) : try : user_data = base64 . b64decode ( user_data ) except TypeError : return False return True
check if the user_data is encoded properly .