docs: def set_snap_server_variables(host, port, snap_extension='.xml', path=None):
      """ Change dynamically port and host variable in xml Snap! project file"""
  
      localdir = os.getcwd()
      if path is None:
          os.chdir(os.path.dirname(os.path.realpath(__file__)))
      else:
          os.chdir(path)
      xml_files = [f for f in os.listdir('.') if f.endswith(snap_extension)]
      for filename in xml_files:
          with open(filename, 'r') as xf:
              xml = xf.read()
          # Change host variable
          xml = re.sub(r'''<variable name="host"><l>[\s\S]*?<\/l><\/variable>''',
                       '''<variable name="host"><l>{}</l></variable>'''.format(host), xml)
          # Change host argument of "set $robot host"
          xml = re.sub(r'''<custom-block s="set \$robot host to \%s"><l>[\s\S]*?<\/l>''',
                       '''<custom-block s="set $robot host to %s"><l>{}</l>'''.format(host), xml)
          # Change port variable
          xml = re.sub(r'''<variable name="port"><l>[\s\S]*?<\/l><\/variable>''',
                       '''<variable name="port"><l>{}</l></variable>'''.format(port), xml)
  
          with open(filename, 'w') as xf:
              xf.write(xml)
      os.chdir(localdir)