<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_tracking_branch(self, remote_reference):
 """ Configure this branch to track the given remote reference. This will alter this branch's configuration accordingly. :param remote_reference: The remote reference to track or None to untrack any references :return: self"""

        from .remote import RemoteReference
        if remote_reference is not None and not isinstance(remote_reference, RemoteReference):
            raise ValueError("Incorrect parameter type: %r" % remote_reference)
        # END handle type

        with self.config_writer() as writer:
            if remote_reference is None:
                writer.remove_option(self.k_config_remote)
                writer.remove_option(self.k_config_remote_ref)
                if len(writer.options()) == 0:
                    writer.remove_section()
            else:
                writer.set_value(self.k_config_remote, remote_reference.remote_name)
                writer.set_value(self.k_config_remote_ref, Head.to_full_path(remote_reference.remote_head))

        return self