def bycode(ent, group):
    """
    Get the data with the given group code from an entity.

    Arguments:
        ent: An iterable of (group, data) tuples.
        group: Group code that you want to retrieve.

    Returns:
        The data for the given group code. Can be a list of items if the group
        code occurs multiple times.
    """
    data = [v for k, v in ent if k == group]
    if len(data) == 1:
        return data[0]
    return data