(1)A sheriff or justice of the peace may grant a warrant under this section in relation to premises if satisfied—
(a)that there are reasonable grounds for believing that—
(i)an offence under section 2 or 3 has been or is being committed at the premises, or
(ii)the premises have been or are being used in connection with an offence under section 2 or 3, and
(b)condition A or condition B is satisfied.
(2)Condition A is—
(a)that admission to the premises has been refused or a refusal may be reasonably expected, or
(b)that notice of the intention to seek a warrant has been given to the occupier of the premises, or the giving of such notice would frustrate the purpose for which the warrant is sought.
(3)Condition B is—
(a)that the premises are unoccupied, or
(b)that the occupier of the premises is temporarily absent.