def get_valid_segment(text):
    """ Returns None or the valid Loki-formatted urn segment for the given input string. """

    if text == '':
        return None
    else:
        # Return the converted text value with invalid characters removed.
        valid_chars = ['.', '_', '-']
        new_text = ''
        for char in text:
            if char in valid_chars or char.isalnum():
                new_text += char
        return new_text