a quick google search offered me a lot of solutions. this is the one that worked in my case, and is just 2 lines! for convenience i just placed it in a function.
so using the function above, you have the following line somewhere:
and somewhere else you have a table that is defined like this: