<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def is_ancestor(self, commit1, commit2, patch=False):
 """Returns True if commit1 is a direct ancestor of commit2, or False otherwise. This method considers a commit to be a direct ancestor of itself"""

        result = self.hg("log", "-r", "first(%s::%s)" % (commit1, commit2),
                         "--template", "exists", patch=patch)
        return "exists" in result