<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def read(self, given_file):
 """ Read given_file to self.contents Will ignoring duplicate lines if self.unique is True Will sort self.contents after reading file if self.sorted is True """

        if self.unique is not False and self.unique is not True:
            raise AttributeError("Attribute 'unique' is not True or False.")
        self.filename = str.strip(given_file)
        self.log('Read-only opening {0}'.format(self.filename))
        with open(self.filename, 'r') as handle:
            for line in handle:
                line = line.rstrip('\r\n')
                if line is None:
                    line = ''  # Blank lines that were just \n become None so convert them to empty string.
                if self.unique is False or line not in self.contents:
                    self.contents.append(line)
        if self.sorted:
            self.sort()
        self.log('Read {0} lines.'.format(len(self.contents)))
        return True