def should_set_tablename(cls):
if (<EOL>cls.__dict__.get('<STR_LIT>', False)<EOL>or not any(isinstance(b, DeclarativeMeta) for b in cls.__mro__[<NUM_LIT:1>:])<EOL>):<EOL><INDENT>return False<EOL><DEDENT>for base in cls.__mro__:<EOL><INDENT>if '<STR_LIT>' not in base.__dict__:<EOL><INDENT>continue<EOL><DEDENT>if isinstance(base.__dict__['<STR_LIT>'], declared_attr):<EOL><INDENT>return False<EOL><DEDENT>return not (<EOL>base is cls<EOL>or base.__dict__.get('<STR_LIT>', False)<EOL>or not isinstance(base, DeclarativeMeta)<EOL>)<EOL><DEDENT>return True<EOL>
Determine whether ``__tablename__`` should be automatically generated
    for a model.

    * If no class in the MRO sets a name, one should be generated.
    * If a declared attr is found, it should be used instead.
    * If a name is found, it should be used if the class is a mixin, otherwise
      one should be generated.
    * Abstract models should not have one generated.

    Later, :meth:`._BoundDeclarativeMeta.__table_cls__` will determine if the
    model looks like single or joined-table inheritance. If no primary key is
    found, the name will be unset.