Whoever, being an officer, agent, or employee of the United States or any department or agency thereof, engaged in the enforcement of any law of the United States, searches any private dwelling used and occupied as such dwelling without a warrant directing such search, or maliciously and without reasonable cause searches any other building or property without a search warrant, shall be fined under this title for a first offense; and, for a subsequent offense, shall be fined under this title or imprisoned not more than one year, or both.
This section shall not apply to any person—
(a)
serving a warrant of arrest; or
(b)
arresting or attempting to arrest a person committing or attempting to commit an offense in his presence, or who has committed or is suspected on reasonable grounds of having committed a felony; or
(c)
making a search at the request or invitation or with the consent of the occupant of the premises.