'Determine if the <p> tags around paragraph ``node`` can be omitted.'

def should_be_compact_paragraph(self, node):

    if (isinstance(node.parent, nodes.document) or isinstance(node.parent, nodes.compound)):
        return 0
    for (key, value) in node.attlist():
        if (node.is_not_default(key) and (not ((key == 'classes') and (value in ([], ['first'], ['last'], ['first', 'last']))))):
            return 0
    first = isinstance(node.parent[0], nodes.label)
    for child in node.parent.children[first:]:
        if isinstance(child, nodes.Invisible):
            continue
        if (child is node):
            break
        return 0
    parent_length = len([n for n in node.parent if (not isinstance(n, (nodes.Invisible, nodes.label)))])
    if (self.compact_simple or self.compact_field_list or (self.compact_p and (parent_length == 1))):
        return 1
    return 0
