def assign_exit_code(fit_succeeded, gulp_errors, parser_errors):
    """ given the error messages, assign an exit code """
    if '**** No. of variables exceeds no. of observables ****' in gulp_errors:
        return 'ERROR_NOT_ENOUGH_OBSERVABLES'
    elif '**** No lower sum of squares could be found ****' in gulp_errors:
        return 'ERROR_FIT_UNSUCCESFUL'
    elif not fit_succeeded:
        return 'ERROR_FIT_UNSUCCESFUL'
    elif gulp_errors:
        return 'ERROR_GULP_UNKNOWN'
    elif parser_errors:
        return 'ERROR_PARSING_STDOUT'
    return None
