def get_fs_basis_name(function_space, qr_var=None, on_space=None):
    """
    Returns a name for the basis function on this FunctionSpace. If
    the name of an associated quadrature object is supplied then this
    is appended to the returned name. Similarly, if the function space
    at which the basis is to be evaluated is supplied then this is
    also appended to the name.

    :param function_space: the function space for which the basis is required
    :type function_space: :py:class:`psyclone.dynamo0p3.FunctionSpace`
    :param string qr_var: the name of the Quadrature Object for which the
                          basis functions are required
    :param on_space: the function space at which the basis functions
                     will be evaluated
    :type on_space: :py:class:`psyclone.dynamo0p3.FunctionSpace`
    :return: Name for the Fortran array holding the basis function
    :rtype: string
    """
    name = '_'.join(['basis', function_space.mangled_name])
    if qr_var:
        name += '_' + qr_var
    if on_space:
        name += '_on_' + on_space.mangled_name
    return name
