(2)Where immediate action is necessary, the Secretary shall before giving such notice or before the period of such notice expires cause to secure, lop or cut down the said tree or branch thereof or remove the fruits thereof or fence off a part of any street or take such other temporary measures as he deems fit to prevent danger, and the cost thereof shall be recoverable from the owner of the tree in the manner provided in section 538.