def _nameToLabels(name):
    """
    Split a domain name into its constituent labels.

    @type name: L{bytes}
    @param name: A fully qualified domain name (with or without a
        trailing dot).

    @return: A L{list} of labels ending with an empty label
        representing the DNS root zone.
    """
    if name in (b'', b'.'):
        return [b'']
    labels = name.split(b'.')
    if labels[-1] != b'':
        labels.append(b'')
    return labels

    Split a domain name into its constituent labels.

    @type name: L{bytes}
    @param name: A fully qualified domain name (with or without a
        trailing dot).

    @return: A L{list} of labels ending with an empty label
        representing the DNS root zone.
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/names/dns.py