<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_style(self, title=None,defaults=None,mappings=None, 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 :returns: nothing """

        u=self.__url
        host=u.split("//")[1].split(":")[0]
        port=u.split(":")[2].split("/")[0]
        version=u.split(":")[2].split("/")[1]

        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 = requests.get(URL).json()

        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)