from bs4 import BeautifulSoup


def parse_body(message):
    """Parses text body from email message object with BeautifulSoup.

    Parameters:
        message (email.Message object): Loaded email with Python standard library email module.

    Returns:
        body (str): Email text body.

    """
    body = ''

    if message.is_multipart():
        for part in message.walk():
            content_type = part.get_content_type()
            content_disposition = str(part.get('Content-Disposition'))

            if (content_type in ['text/html', 'text/txt'] and
                'attachment' not in content_disposition):
                body = part.get_payload(decode=True)
                break
    else:
        body = message.get_payload(decode=True)

    return BeautifulSoup(body, 'html5lib').get_text()