<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def namedb_get_num_names( cur, current_block, include_expired=False ):
 """ Get the number of names that exist at the current block """

    unexpired_query = ""
    unexpired_args = ()

    if not include_expired:
        # count all names, including expired ones
        unexpired_query, unexpired_args = namedb_select_where_unexpired_names( current_block )
        unexpired_query = 'WHERE {}'.format(unexpired_query)

    query = "SELECT COUNT(name_records.name) FROM name_records JOIN namespaces ON name_records.namespace_id = namespaces.namespace_id " + unexpired_query + ";"
    args = unexpired_args

    num_rows = namedb_select_count_rows( cur, query, args, count_column='COUNT(name_records.name)' )
    return num_rows