def parse_fromaddr(fromaddr):
    """Generate an RFC 822 from-address string.

    Simple usage::

        >>> parse_fromaddr('from@example.com')
        'from@example.com'
        >>> parse_fromaddr(('from', 'from@example.com'))
        'from <from@example.com>'

    :param fromaddr: string or tuple
    """
    if isinstance(fromaddr, tuple):
        fromaddr = "%s <%s>" % fromaddr
    return fromaddr