'Opens the record file.'

def open(self):

    if (self.flag == 'w'):
        check_call(_LIB.MXRecordIOWriterCreate(self.uri, ctypes.byref(self.handle)))
        self.writable = True
    elif (self.flag == 'r'):
        check_call(_LIB.MXRecordIOReaderCreate(self.uri, ctypes.byref(self.handle)))
        self.writable = False
    else:
        raise ValueError(('Invalid    flag    %s' % self.flag))
    self.is_open = True
