22Further restrictions on entering housesS
(1)An enforcement officer may take action under section 18 or 20 in relation to a house or a place that can be entered only through a house only if—
(a)an individual who habitually resides in the house permits the enforcement officer to do so, or
(b)the sheriff grants a warrant for such an action.
(2)Where subsection (1)(a) applies, an enforcement officer may enter a house only—
(a)at reasonable times, and
(b)if accompanied by a constable.
(3)The sheriff may grant a warrant under this section on the application of an enforcement officer only if satisfied—
(a)that the officer has reasonable grounds for taking action under section 18 or 20 in relation to the house or the place that can be entered only through the house, and
(b)that any of the conditions in subsection (4) is met.
(4)Those conditions are—
(a)that the officer has been refused entry to the house or place or has been prevented from taking any other action under section 18 or 20 in relation to the house or place,
(b)that such a refusal or prevention is reasonably expected (after the officer has taken reasonable steps to notify the residents of the house of the intended action),
(c)that—
(i)the house is unoccupied (permanently or temporarily), and
(ii)the officer has taken reasonable steps to notify any residents of the house of the intended action,
(d)that the case is one of urgency, or
(e)that notifying the residents of the house of the officer's intention to take action would defeat the object of the proposed action.
(5)A warrant granted under this section expires—
(a)when it is no longer required for the purpose for which it was granted, or
(b)if earlier, on the expiry of such period as may be specified in it.