How to handle rental electrical rewiring cost

I have a single family rental that needed extensive electrical repairs while being occupied by a tenant. The work done was to rewire the house electrical from the main breaker box to all outlets. The cost was $21k. Is this expensed, or does it need to be depreciated? It was work needed for habitability. If it needs to be depreciated, over what time period?  -- Thanks,