def extract_user_mentions(text):
 from r2.lib.validator import chkuser
 usernames = set()
 for url in extract_urls_from_markdown(text):
  if (not url.startswith('/u/')):
   continue
  username = url[len('/u/'):]
  if (not chkuser(username)):
   continue
  usernames.add(username.lower())
 return usernames

def extract_user_mentions ( text ) : from r2 . lib . validator import chkuser usernames = set ( ) for url in extract_urls_from_markdown ( text ) : if ( not url . startswith ( '/u/' ) ) : continue username = url [ len ( '/u/' ) : ] if ( not chkuser ( username ) ) : continue usernames . add ( username . lower ( ) ) return usernames
return a set of all usernames mentioned in markdown text .