Replaced binary function by Python's binary formatting