'Serialize this header for use in a request or response.'

def toString(self):

    s = ('SIP/2.0/%s    %s:%s' % (self.transport, self.host, self.port))
    if self.hidden:
        s += ';hidden'
    for n in ('ttl', 'branch', 'maddr', 'received'):
        value = getattr(self, n)
        if (value is not None):
            s += (';%s=%s' % (n, value))
    if self.rportRequested:
        s += ';rport'
    elif (self.rportValue is not None):
        s += (';rport=%s' % (self.rport,))
    etc = sorted(self.otherParams.items())
    for (k, v) in etc:
        if (v is None):
            s += (';' + k)
        else:
            s += (';%s=%s' % (k, v))
    return s
