def get_svtype(read):
    """
    Classify type of discordant read based on orientation.

    Parameters
    ----------
    read : pysam.AlignedRead
        Read to classify

    Returns
    -------
    svtype : str
        One of 'del', 'dup', 'inv', or 'tloc'
    """

    if read.tid != read.rnext:
        return 'tloc'
    if read.is_reverse == read.mate_is_reverse:
        return 'inv'
    if read.pos < read.pnext:
        if read.is_reverse:
            return 'dup'
        else:
            return 'del'
    else:
        if read.is_reverse:
            return 'del'
        else:
            return 'dup'