'What does pack("B*", $s) do In Perl?

I am migrating some perl code to python and cant seem to understand what

pack("B*", $s)

does in perl.

Is there an equivalent in Python?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source