def _master_ref(self, origin):
        """
        Finds the master ref object that matches master branch.
        """
        for ref in origin.refs:
            if ref.remote_head == self.master_branch:
                return ref

        raise MissingMasterBranch(
            'Could not find ref for {0}'.format(self.master_branch))

        Finds the master ref object that matches master branch.
        
src/gitsweep/base.py