Traces of Sobolev Functions on Fractal Type Sets and Characterization of Extension Domains