<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove_trailing_stars(self, new_path=None, in_place=True, check=False):
 """Remove the bad character that can be inserted by some programs at the end of sequences."""

        # Optional check #
        if check and int(sh.grep('-c', '\*', self.path, _ok_code=[0,1])) == 0: return self
        # Faster with bash utilities #
        if in_place is True:
            sh.sed('-i', 's/\*$//g', self.path)
            return self
        # Standard way #
        if new_path is None: new_fasta = self.__class__(new_temp_path())
        else:                new_fasta = self.__class__(new_path)
        new_fasta.create()
        for seq in self: new_fasta.add_str(str(seq.seq).rstrip('*'), seq.id)
        new_fasta.close()
        return new_fasta