def is_attachment(part):
    """Return True if message part looks like an attachment."""
    return (
        part.get_content_maintype() != "multipart" and
        part.get_content_maintype() != "text" and
        part.get("Content-Disposition") != "inline" and
        part.get("Content-Disposition") is not None
    )