'Dict-like set() that also supports optional domain and path args in
order to resolve naming collisions from using one cookie jar over
multiple domains.'

def set(self, name, value, **kwargs):

    if (value is None):
        remove_cookie_by_name(self, name, domain=kwargs.get('domain'), path=kwargs.get('path'))
        return
    if isinstance(value, Morsel):
        c = morsel_to_cookie(value)
    else:
        c = create_cookie(name, value, **kwargs)
    self.set_cookie(c)
    return c
