@register.filter(name='key_exist')
def key_exist(username):
 if os.path.isfile(os.path.join(KEY_DIR, 'user', (username + '.pem'))):
  return True
 else:
  return False

@ register . filter ( name = 'key_exist' ) def key_exist ( username ) : if os . path . isfile ( os . path . join ( KEY_DIR , 'user' , ( username + '.pem' ) ) ) : return True else : return False
ssh key is exist or not .