code: def set_metadata(self, loadbalancer, metadata, node=None):
          
          # Delete any existing metadata
          self.delete_metadata(loadbalancer, node=node)
          # Convert the metadata dict into the list format
          metadata_list = [{"key": key, "value": val}
                  for key, val in metadata.items()]
          if node:
              uri = "/loadbalancers/%s/nodes/%s/metadata" % (
                      utils.get_id(loadbalancer), utils.get_id(node))
          else:
              uri = "/loadbalancers/%s/metadata" % utils.get_id(loadbalancer)
          req_body = {"metadata": metadata_list}
          resp, body = self.api.method_post(uri, body=req_body)
          return body
docs: Sets the metadata for the load balancer to the supplied dictionary
          of values. Any existing metadata is cleared. If 'node' is provided,
          the metadata for that node is set instead of for the load balancer.