'Update a local area network
:param  lan: The lan you wish to update.
:type:  lan: :class:`ProfitBricksLan`
:param  is_public: Boolean indicating if
the lan faces the public internet.
:type   is_public: ``bool``
:param  name: The name of the lan.
:type   name: ``str``
:return:    Instance class ``ProfitBricksLan``
:rtype:     :class:`ProfitBricksLan`'

def ex_update_lan(self, lan, is_public, name=None):

    action = lan.href
    body = {'public': is_public}
    if (name is not None):
        body['name'] = name
    request = self.connection.request(action=action, headers={'Content-Type': 'application/json'}, data=body, method='PATCH', with_full_url=True)
    return self._to_lan(request.object, request.headers)
