def connection(self, collectionname, dbname=None):
if not collectionname or "<STR_LIT:..>" in collectionname:<EOL><INDENT>raise DataError("<STR_LIT>")<EOL><DEDENT>if "<STR_LIT:$>" in collectionname and not (collectionname.startswith("<STR_LIT>") or<EOL>collectionname.startswith("<STR_LIT>")):<EOL><INDENT>raise DataError("<STR_LIT>"<EOL>"<STR_LIT>" % collectionname)<EOL><DEDENT>if collectionname.startswith("<STR_LIT:.>") or collectionname.endswith("<STR_LIT:.>"):<EOL><INDENT>raise DataError("<STR_LIT>"<EOL>"<STR_LIT>" % collectionname)<EOL><DEDENT>if "<STR_LIT:\x00>" in collectionname:<EOL><INDENT>raise DataError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>return Cursor(dbname or self._pool._dbname, collectionname, self._pool)<EOL>
Get a cursor to a collection by name.

        raises `DataError` on names with unallowable characters.

        :Parameters:
          - `collectionname`: the name of the collection
          - `dbname`: (optional) overide the default db for a connection