def list_to_str(a_list,
                delimiter = "\t",
                newline = True):

    """
    =================================================================================================
    list_to_str(a_list, delimiter, newline)
    
    Given a list, the delimiter (default '\t'), and whether to add a trailing newline
    character, take a list and convert the list into a string where each element is
    separated by the chosen delimiter.
    
    =================================================================================================
    Arguments:
    
    a_list     ->  A list
    delimiter  ->  A string to separate the elements of the list in a string
    newline    ->  A boolean that determines whether to add a newline character to the output string
    
    =================================================================================================
    Returns: A string containing the elements of a_list, separated by delimtmer, with or without
             a newline character
    
    =================================================================================================
    Example:

    a = [1,2,3]
    print(list_to_str(a))

    -> '1\t2\t3\n'
    =================================================================================================
    """
    # Make sure the user inputs the proper typed objects.
    # newline argument needs to be a boolean
    assert newline in [True, False], "newline argument must be a boolean"
    # a_list argument needs to be an iterable, specifically a list/tuple
    assert type(a_list) in [list, tuple], "The argument 'a_list' should be a list or a tuple."
    # These are the delimiter characters that I am currently able to work with
    #assert delimiter in [':', '|', ';', '-', '\\',
    #                     '/', ',', '\t', '\n', "",
    #                     " vs "], f"The delimiter provided is not an accepted delimiter."

    # Initialize the new string with the first element of the list.
    # This avoids having to slice the strings later
    newstr = f"{a_list[0]}"
    # If the list only has one element and the user elects to use
    # a trailing newline character
    if len(a_list) == 1 and newline:
        # Then simply return the newstr variable with an added
        # newline character
        return f"{newstr}\n"
    # If the list has only one element and the user does not elect to
    # use a trailing newline character
    elif len(a_list) == 1 and not newline:
        # Then simply return the newstr variable
        return f"{newstr}"

    # If the list has more then one element, then loop over all elements
    # (excluding the first one since that is already in the string)
    for i in range(1,len(a_list)):
        # and add those new elements to the newstring with the given
        # delimiter separating the elements.
        newstr = f"{newstr}{delimiter}{a_list[i]}"
    # If the user elects to use a trailing newline character
    if newline:
        # Then add the trailing newline character and return the string
        return f"{newstr}\n"
    # If the user does not elect to use a trailing newline character
    else:
        # Then simply return the newstr variable
        return newstr