What does pack, unpack, to_variant, from_variant functions do in EOS implementation code?

I have been trying to understand the EOS implementation code of the latest version therein https://github.com/EOSIO/eos/tree/v1.7.4/

I am always struck when I see functions like pack, unpack, to_variant and from_variant. I am unable to understand what these functions are meant for. I wonder if anyone of you could please explain the purpose of these functions in EOS implementation code.

These are some of the contracts which I got these functions: