Self-similar thinning of a liquid film separating liquid phases or a liquid and a solid phase