<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def s2n(self, offset, length, signed=0):
 """ Convert slice to integer, based on sign and endian flags. Usually this offset is assumed to be relative to the beginning of the start of the EXIF information. For some cameras that use relative tags, this offset may be relative to some other starting point. """

        self.file.seek(self.offset + offset)
        sliced = self.file.read(length)
        if self.endian == 'I':
            val = s2n_intel(sliced)
        else:
            val = s2n_motorola(sliced)
            # Sign extension?
        if signed:
            msb = 1 << (8 * length - 1)
            if val & msb:
                val -= (msb << 1)
        return val