def get_canonical_form(mpa):
    """
       Returns canonical form of mpa. Is either 'left', 'right' or None
    """
    cform = mpa.canonical_form
    if cform[0] == len(mpa) - 1:
        return 'left'
    elif cform[1] == 1:
        return 'right'
    else:
        return None