Remove duplicated code from bokeh/session* (#416)