def custom_min(trees):
    """ Takes a list of tuples called trees, finds the smallest
    item and removes it from the list. Both the smallest item and
    new list are returned.

    Each item in trees is a tuple of (symbol, frequency)
    """

    if len(trees) == 0:
        raise ValueError("The list passed as input was empty.")

    # default to the first item
    min_item = trees[0]
    min_index = 0

    for i in range(len(trees)):
        # if this item has a smaller frequency
        if trees[i][1] < min_item[1]:
            min_item = trees[i]
            min_index = i

    del trees[min_index]

    return min_item[0], min_item[1], trees