'Returns author\'s name and email if any'

def get_email_author(self, msg):

    try:
        header_from = msg['From']
        splits = header_from.split('<', 1)
        (name, email) = (splits if (len(splits) == 2) else ('', header_from))
        email = email.split('>', 1)[0]
        if name:
            (name, encoding) = decode_header(name.strip('    "\''))[0]
            name = self.decode(name, encoding)
            name = name.strip('    \'"')
    except:
        email = name = None
    if (not email):
        try:
            email = msg['Return-path']
            email.strip('    \'"<>')
        except Exception:
            email = None
    return (name, email)
