def getusername(cursor, displayname):
	"""Retrieve internal username from display name."""
	
	cursor.execute("select username from profile where displayname = ?;", (displayname,))
	
	username = cursor.fetchone()
	
	if username is None:
		return None
	
	return username[0]