def start(self, *pages):
    """ Takes a list of Page instances, creates html files, and starts
        the server. """

    # Make sure at least one page has been given:
    if not(pages):
      print "*Can't start server - no pages provided."
      return

    # Make sure pages/ directory exists:
    if not(os.path.exists(PAGES_DIR)):
      os.system("mkdir %s" % PAGES_DIR)
    # Remove old pages if any:
    if (os.listdir(PAGES_DIR)):
      os.system("rm %s/*" % PAGES_DIR)
    
    # We treat the first page passed in as the home page and create
    # an index.html page in the base directory that redirects to it:
    home = pages[0]
    with open(INDEX, 'w') as index:
      with open(INDEX_TEMPLATE, 'r') as index_template:
        index.write(index_template.read() % home.filename)

    # Generate a list of links for the sidebar:
    links = ''
    for page in pages:
      links += '<li><a href="%s">%s</a></li>\n' % (page.filename, page.title)

    # Add sidebar to each page and write them to files:
    for page in pages:
      path =  "%s/%s" % (PAGES_DIR, page.filename)
      with open(path, 'w') as f:
        f.write(str(page) % links)

    # Start srver in a daemon thread:
    server_thread = threading.Thread(target=self._server.serve_forever)
    server_thread.daemon = True
    server_thread.start()
    
    if (self.blocking):
      try:
        while(True): delay(10000)
      except __HOLE__:
        pass
dataset/ETHPy150Open graycatlabs/PyBBIO/bbio/libraries/BBIOServer/bbio_server.py/BBIOServer.start