Brexit came to define her time as prime minister, but Theresa May had a long and varied political career.