Implement get_table_from_ref and is_valid_ref

Signed-off-by: David Scott <dave.scott@eu.citrix.com>