def get_cassandra_connection(alias=None, name=None):
for _alias, connection in get_cassandra_connections():<EOL><INDENT>if alias is not None:<EOL><INDENT>if alias == _alias:<EOL><INDENT>return connection<EOL><DEDENT><DEDENT>elif name is not None:<EOL><INDENT>if name == connection.settings_dict['<STR_LIT>']:<EOL><INDENT>return connection<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return connection<EOL><DEDENT><DEDENT>
:return: cassandra connection matching alias or name or just first found.