<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_alternates(self, alts):
 """Sets the alternates :param alts: is the array of string paths representing the alternates at which git should look for objects, i.e. /home/user/repo/.git/objects :raise NoSuchPathError: :note: The method does not check for the existence of the paths in alts as the caller is responsible."""

        alternates_path = osp.join(self.common_dir, 'objects', 'info', 'alternates')
        if not alts:
            if osp.isfile(alternates_path):
                os.remove(alternates_path)
        else:
            with open(alternates_path, 'wb') as f:
                f.write("\n".join(alts).encode(defenc))