I'd have to guess that the snake managed to get it's head into a small space so constricted as to resist backing out again due to the direction of the scales. Compression as well as struggling on the part of the animal could form the indentation. With luck he/she will return to normal or at least not have a adverse effect on feeding. Double check any lid associated lip or gap... As it will surely be revisited.

