def get_column_indices(tag_pattern, columns):
    """Return a list of column indices matching tag_pattern
    @param tag_pattern: the hxl.model.TagPattern to test
    @param columns: a sequence of hxl.model.Column objects to test
    @returns: a possibly-empty sequence of integer indices into columns
    """
    indices = []
    for i, column in enumerate(columns):
        if tag_pattern.match(column):
            indices.append(i)
    return indices