def METHOD_NAME(item, sep_boundary):
    key, values = item
    title = '\nContent-Disposition: form-data; name="%s"' % key
    # handle multiple entries for the same name
    if not isinstance(values, list):
        values = [values]
    for value in values:
        if isinstance(value, tuple):
            title += '; filename="%s"' % value[0]
            value = value[1]
        else:
            value = _encode(value)
        yield sep_boundary
        yield _encode(title)
        yield b"\n\n"
        yield value
        if value and value[-1:] == b'\r':
            yield b'\n'  # write an extra newline (lurve Macs)