Please check the functions in util.inc to read existing aliases.

You can easily check and fetch this information by using the global tables available there.