Метод питона выравнивать центр

print("{:^thenumberofchractersinthisline}".format("the string"))
Pleasant Pony