The way you are mirroring the left half is wrong, try:
mirrored = int(left_half + left_half[:(length // 2)][::-1])