Updates a visual style
    
    :param title: title of the visual style
    :param defaults: a list of dictionaries for each visualProperty
    :param mappings: a list of dictionaries for each visualProperty
    :param host: cytoscape host address, default=cytoscape_host
    :param port: cytoscape port, default=1234
    
    :retunrs: nothing

def update_style(title,defaults=None,mappings=None,host=cytoscape_host,port=cytoscape_port,verbose=False):
    """
    Updates a visual style
    
    :param title: title of the visual style
    :param defaults: a list of dictionaries for each visualProperty
    :param mappings: a list of dictionaries for each visualProperty
    :param host: cytoscape host address, default=cytoscape_host
    :param port: cytoscape port, default=1234
    
    :retunrs: nothing
    """

    if defaults: 
        defaults_=[]    
        for d in defaults:
            if d:
                defaults_.append(d)
        defaults=defaults_

    if mappings:
        mappings_=[]
        for m in mappings:
            if m:
                mappings_.append(m)
        mappings=mappings_


    URL="http://"+str(host)+":"+str(port)+"/v1/styles/"+str(title)
    if verbose:
        print(URL)
        sys.stdout.flush()

    response = urllib2.urlopen(URL)    
    response = response.read()
    response = json.loads(response)
    
    olddefaults=response["defaults"]
    oldmappings=response["mappings"]

    if mappings:
        mappings_visual_properties=[ m["visualProperty"] for m in mappings ]
        newmappings=[ m for m in oldmappings if m["visualProperty"] not in mappings_visual_properties ]
        for m in mappings:
            newmappings.append(m)
    else:
        newmappings=oldmappings

    if defaults:
        defaults_visual_properties=[ m["visualProperty"] for m in defaults ]
        newdefaults=[ m for m in olddefaults if m["visualProperty"] not in defaults_visual_properties ]
        for m in defaults:
            newdefaults.append(m)
    else:
        newdefaults=olddefaults
        
    r=requests.delete(URL)
    CheckResponse(r)    

    URL="http://"+str(host)+":"+str(port)+"/v1/styles"
    PARAMS={"title":title,\
           "defaults":newdefaults,\
           "mappings":newmappings}
    r = requests.post(url = URL, json = PARAMS)
    CheckResponse(r)