A peace officer may break open a building or vessel to liberate a person who entered to make an arrest and is detained, or to liberate oneself when necessary.