To say Fernando Haddad has had a busy few months is an understatement. Mr Haddad replaced former President Luiz Inácio Lula da Silva as the presidential candidate for the Workers' Party less than a month before the first round of the election.
After he made it into the run-off which took place 28 October, his life got even busier as he tried - and ultimately failed - to win over voters to beat his right-wing rival Jair Bolsonaro.
When Fernando Haddad stood in for Lula on 11 September after electoral authorities banned the former leader from running for president because of his conviction for corruption and money laundering, he was relatively unknown.
The 55-year-old had served as mayor of São Paulo and also as education minister but had little name recognition outside São Paulo.
Lula's wholehearted endorsement was therefore key for Mr Haddad.
As Lula is serving a 12-year prison sentence, that endorsement came in the form of a letter written from his cell: "From now on, Haddad will be Lula for millions of Brazilians," it read.
- Born in São Paulo on 25 January 1963, the second son of a family of Lebanese immigrants
- Has a bachelor's degree from the University of Sao Paulo with a specialisation in civil law, later earned a master's degree in economics and a doctorate in philosophy
- His first political post was as sub-secretary of finance and economic development of São Paulo in 2001
- Was education minister under President Lula from 2005 to 2012
- Mayor of São Paulo from 2013 to 2017
A lot of voters who had backed Lula switched allegiances from Lula to Mr Haddad - he rose from 4% to 23% in the pre-election opinion polls - but he was not able to reach the almost 40% who had said they intended to vote for Lula.
There is little doubt that Lula is a political godfather to Mr Haddad but despite the close links between the two men, Mr Haddad sought to project a slightly different image to that of the 72-year-old former president.
Above all, Mr Haddad tried to portray himself as more of a moderate than the firebrand, working-class Lula. Part of Mr Haddad's campaign strategy was to try to woo the wider electorate with promises of gradual reforms.
These promises came after turbulent years in which Brazil was rocked by an increase in violent crime and a huge political bribery scandal that has tainted the entire political class, ensnaring not only Lula but several other senior figures in the Workers' Party.
In politically polarised Brazil, Lula's mantle proved as much a liability as a boost to Mr Haddad, and it was difficult for him to find the right balance.