def raster(self, path, size, bandtype=gdal.GDT_Byte):
path = getattr(path, '<STR_LIT:name>', path)<EOL>try:<EOL><INDENT>is_multiband = len(size) > <NUM_LIT:2><EOL>nx, ny, nbands = size if is_multiband else size + (<NUM_LIT:1>,)<EOL><DEDENT>except (TypeError, ValueError) as exc:<EOL><INDENT>exc.args = ('<STR_LIT>',)<EOL>raise<EOL><DEDENT>if nx < <NUM_LIT:1> or ny < <NUM_LIT:1>:<EOL><INDENT>raise ValueError('<STR_LIT>' % (size,))<EOL><DEDENT>if not self._is_empty(path):<EOL><INDENT>raise IOError('<STR_LIT>' % path)<EOL><DEDENT>ds = self.Create(path, nx, ny, nbands, bandtype)<EOL>if not ds:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>' % (path, str(self)))<EOL><DEDENT>return Raster(ds)<EOL>
Returns a new Raster instance.

        gdal.Driver.Create() does not support all formats.

        Arguments:
        path -- file object or path as str
        size -- two or three-tuple of (xsize, ysize, bandcount)
        bandtype -- GDAL pixel data type