def METHOD_NAME(self, dump_dir, readonly=False):
    flags = 0
    if readonly:
        flags |= report.DD_OPEN_READONLY
    ddir = report.dd_opendir(dump_dir, flags)
    if not ddir:
        raise problem.exception.InvalidProblem(
            'Can\'t open directory: {0}'.format(dump_dir))
    return ddir