That would be hard to differentiate between an userid and an index, but I suppose it's possible.
def findUseridByIndex(index):
index = int(index)
playerlist = es.createplayerlist()
for userid in playerlist:
if playerlist[userid]['index'] == index:
return userid
return es.getuserid(index)
Sorry, this removed the formatting but I think you get the idea.