Planetary habitability: lessons learned from terrestrial analogues