<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _sam_to_soft_clipped(self, sam):
        '''Returns tuple of whether or not the left and right end of the mapped read in the sam record is soft-clipped'''
        if sam.is_unmapped:
            raise Error('Cannot get soft clip info from an unmapped read')

        if sam.cigar is None or len(sam.cigar) == 0:
            return False, False
        return (sam.cigar[0][0] == 4, sam.cigar[-1][0] == 4)