def command(cmd, *parameters):
    """
    Helper function. Prints the gprMax #<cmd>: <parameters>. None is ignored
    in the output.

    Args:
        cmd (str): the gprMax cmd string to be printed
        *parameters: one or more strings as arguments, any None values are
            ignored

    Returns:
        s (str): the printed string
    """

    # remove Nones
    filtered = filter(lambda x: x is not None, parameters)
    # convert to str
    filtered_str = map(str, filtered)
    # convert to list
    filtered_list = list(filtered_str)
    try:
        s = '#{}: {}'.format(cmd, " ".join(filtered_list))
    except TypeError as e:
        # append info about cmd and parameters to the exception:
        if not e.args:
            e.args = ('', )
        additional_info = "Creating cmd = #{} with parameters {} -> {} failed".format(cmd, parameters, filtered_list)
        e.args = e.args + (additional_info,)
        raise e
    # and now we can print it:
    print(s)
    return s