@publisher(['animation', 'previs', 'shot previs'])
def check_sequence_name_format():
    shot = pm.ls(type='shot')[0]
    sequencer = shot.outputs(type='sequencer')[0]
    sequence_name = sequencer.sequence_name.get()

    # SEQ001_003_TNGI
    # SEQ001_003A_TNGI

    parts = sequence_name.split('_')

    if len(parts) != 3:
        raise PublishError(
            'Sequence name format is not correct!!!<br>'
            '<br>'
            'It should be in the following format:<br>'
            '<br>'
            'SEQXXX_XXX_XXXX'
            '<br>'
            'ex: SEQ001_003_TNGI'
        )

    sequence_code = parts[0]
    scene_number = parts[1]
    scene_code = parts[2]

    # sequence_code should start with SEQ
    if not (sequence_code.startswith('SEQ') or sequence_code.startswith('EP')):
        raise PublishError(
            'Sequence name should start with "SEQ" or "EP"!!!<br>'
            '<br>'
            'Not:<br>'
            '%s' % sequence_code
        )

    # scene number should start with a number
    import re
    if not re.match(r'^[\d]+', scene_number):
        raise PublishError(
            'Scene number in sequence name should start with a number!!!<br>'
            '<br>'
            'Not:<br>'
            '%s' % scene_number
        )

    # scene number should a 3 digit and an optional letter
    if not len(scene_number) in [3, 4, 5]:
        raise PublishError(
            'Scene number in sequence name should be a number with 3 digits '
            'and an optional uppercase letter!!!<br>'
            '<br>'
            'Not:<br>'
            '%s' %
            scene_number
        )

    # scene code should be all upper case letters
    if scene_code != scene_code.upper():
        raise PublishError(
            'Scene code in sequence name should be all upper case letters!!!'
            '<br><br>'
            'Not:'
            '<br>'
            '%s' % scene_code
        )
checks if the sequence name format is correct
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/publish.py/check_sequence_name_format