def attach_domain(corpus, domt):
    """ Indicates whether the corpus is src (source) or tgt
    (target) corpus when doing trainsfer learning.

    This will return a list of lists of the form ((w,t,d),iob), where
    d is the domain ('src' or 'tgt') given by domt.

    Parameters
    ----------

    corpus : list
        List of lists containing tuples of form ((w,t), iob)
    domt : str
        Either 'src' or 'tgt'.

    """
    if domt not in {'src','tgt'}: # Domain type - source or target
        raise ValueError("domt must be 'src' or 'tgt'.")

    data_with_domain = [[((w,t,domt),iob) for ((w,t),iob) in d] for d in corpus]
    return data_with_domain