Since this page will answer to developers performing byte handling therefore performance oriented there should be a benchmarked comparison of above methods.
Assuming we do not require padding (a subject this thread tackles) the aforementioned solutions (including the top answer from the other thread) yield these results (for 10 million random 21-bit integers) :
Results
Benchmark can be find here.
So the f'{x:'b'}' proves faster with the intuitive slicing method as a close second (results were consistent between runs on a r5-3600 cpu and 16GB of 2133MHz 19CL system memory).
In the end the answer from Diego Roccia was the fastest and pretty elegant.
Padding with leading zeros and further options of said method can be found here but using the f'{x:'b'}' with .zfill() for padding is faster than the solutions given there (find actual tests in here).
So the answer is:
f'{x:'b'}'