def _read_mask(self, l, ret, mask='upper'):
        """
        Reads mask from 1 bit file to convert bases to identify poor quality
        bases that will either be converted to lowercase or 'N'. In the
        2 bit file, 'N' or any other invalid base is written as 'A'.
        Therefore the 'N' mask file is required to correctly identify where
        invalid bases are.
        
        Parameters
        ----------
        l : tuple
            location
        ret : list
            list of bases which will be modified in place
        mask : str, optional
            Either 'upper', 'lower', or 'n'. If 'lower', poor quality bases 
            will be converted to lowercase.
        """
        
        if mask.startswith('u'):
            return
         
        file = os.path.join(self.dir, l.chr + ".mask.1bit")
             
        if not os.path.exists(file):
            return
        
        if file != self.__mask_file:
            print('Caching {}...'.format(file))
            f = open(file, 'rb')
            self.__mask_data = f.read()
            f.close()
            self.__mask_file = file
        
        d = DNA2Bit._read1bit(self.__mask_data, l, offset=True)
        
        if mask.startswith(l):
            for i in range(0, len(ret)):
                if d[i] == 1:
                    ret[i] = DNA_UC_TO_LC_MAP[ret[i]] #ret[i].lower()
        else:
            # Use N as mask
            for i in range(0, len(ret)):
                if d[i] == 1:
                    ret[i] = DNA_N_UC
Reads mask from 1 bit file to convert bases to identify poor quality
        bases that will either be converted to lowercase or 'N'. In the
        2 bit file, 'N' or any other invalid base is written as 'A'.
        Therefore the 'N' mask file is required to correctly identify where
        invalid bases are.
        
        Parameters
        ----------
        l : tuple
            location
        ret : list
            list of bases which will be modified in place
        mask : str, optional
            Either 'upper', 'lower', or 'n'. If 'lower', poor quality bases 
            will be converted to lowercase.