<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def replace_meta(self, name, content=None, meta_key=None):
        '''Replace the ``content`` attribute of meta tag ``name``

        If the meta with ``name`` is not available, it is added, otherwise
        its content is replaced. If ``content`` is not given or it is empty
        the meta tag with ``name`` is removed.
        '''
        children = self.meta._children
        if not content:     # small optimazation
            children = tuple(children)
        meta_key = meta_key or 'name'
        for child in children:
            if child.attr(meta_key) == name:
                if content:
                    child.attr('content', content)
                else:
                    self.meta._children.remove(child)
                return
        if content:
            self.add_meta(**{meta_key: name, 'content': content})