<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def tag_helper(tag, items, locked=True, remove=False):
 """ Simple tag helper for editing a object. """

    if not isinstance(items, list):
        items = [items]
    data = {}
    if not remove:
        for i, item in enumerate(items):
            tagname = '%s[%s].tag.tag' % (tag, i)
            data[tagname] = item
    if remove:
        tagname = '%s[].tag.tag-' % tag
        data[tagname] = ','.join(items)
    data['%s.locked' % tag] = 1 if locked else 0
    return data