'Check this object for internal consistency.
:raise ObjectFormatException: if the object is malformed in some way'

def check(self):

    super(Commit, self).check()
    self._check_has_member('_tree', 'missing    tree')
    self._check_has_member('_author', 'missing    author')
    self._check_has_member('_committer', 'missing    committer')
    for parent in self._parents:
        check_hexsha(parent, 'invalid    parent    sha')
    check_hexsha(self._tree, 'invalid    tree    sha')
    check_identity(self._author, 'invalid    author')
    check_identity(self._committer, 'invalid    committer')
    last = None
    for (field, _) in _parse_message(self._chunked_text):
        if ((field == _TREE_HEADER) and (last is not None)):
            raise ObjectFormatException('unexpected    tree')
        elif ((field == _PARENT_HEADER) and (last not in (_PARENT_HEADER, _TREE_HEADER))):
            raise ObjectFormatException('unexpected    parent')
        elif ((field == _AUTHOR_HEADER) and (last not in (_TREE_HEADER, _PARENT_HEADER))):
            raise ObjectFormatException('unexpected    author')
        elif ((field == _COMMITTER_HEADER) and (last != _AUTHOR_HEADER)):
            raise ObjectFormatException('unexpected    committer')
        elif ((field == _ENCODING_HEADER) and (last != _COMMITTER_HEADER)):
            raise ObjectFormatException('unexpected    encoding')
        last = field
