A magnetohydrostatic model of sunspots