<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def table_names(self, cursor=None, **kwargs):
 """ Returns all table names in current keyspace """

        # Avoid migration code being executed
        if cursor:
            return []

        connection = self.connection.connection
        keyspace_name = connection.keyspace
        if not connection.cluster.schema_metadata_enabled and \
                keyspace_name not in connection.cluster.metadata.keyspaces:
            connection.cluster.refresh_schema_metadata()

        keyspace = connection.cluster.metadata.keyspaces[keyspace_name]
        return keyspace.tables