See https://www.thetaxadviser.com/issues/2012/sep/clinic-story-07.html
and
https://www.irs.gov/faqs/capital-gains-losses-and-sale-of-home/losses-homes-stocks-other-property/lo...