'Return the list of items for a given key. If that key is not in the
:class:`Headers`, the return value will be an empty list.  Just as
:meth:`get` :meth:`getlist` accepts a `type` parameter.  All items will
be converted with the callable defined there.
.. versionadded:: 0.9
Added support for `as_bytes`.
:param key: The key to be looked up.
:param type: A callable that is used to cast the value in the
:class:`Headers`.  If a :exc:`ValueError` is raised
by this callable the value will be removed from the list.
:return: a :class:`list` of all the values for the key.
:param as_bytes: return bytes instead of unicode strings.'

def getlist(self, key, type=None, as_bytes=False):

    ikey = key.lower()
    result = []
    for (k, v) in self:
        if (k.lower() == ikey):
            if as_bytes:
                v = v.encode('latin1')
            if (type is not None):
                try:
                    v = type(v)
                except ValueError:
                    continue
            result.append(v)
    return result
