def _get_groups(seq_table, group_by):
    """Return a dictionary of indicate groups of samples

    Args:
        seq_table:
        group_by:

    Returns:

    """
    groups = {}
    if isinstance(group_by, list):
        for ix, group in enumerate(group_by):
            if not isinstance(group, list):
                raise Exception(
                    'Error: if use list, group by should be a 2-D list of sample names'
                    )
            else:
                groups['Set_{}'.format(ix)] = group
    elif isinstance(group_by, dict):
        for group in group_by.values():
            if not isinstance(group, list):
                raise Exception(
                    'Error: if use dict, all values should be a 1-D list of sample names'
                    )
        groups = group_by
    elif isinstance(group_by, str):
        groups = {}
        for sample, content in seq_table.sample_info.items():
            if group_by not in content['metadata'].keys():
                raise Exception('Error: sample {} does not have attribute {}'
                    .format(sample.name, group_by))
            elif content['metadata'][group_by] in groups:
                groups[content['metadata'][group_by]].append(sample)
            else:
                groups[content['metadata'][group_by]] = [sample]
    return groups
