def set_cfme_caselevel(testcase, caselevels):
    """Converts tier to caselevel."""
    tier = testcase.get("caselevel")
    if tier is None:
        return

    try:
        caselevel = caselevels[int(tier)]
    except IndexError:
        # invalid value
        caselevel = "component"
    except ValueError:
        # there's already string value
        return

    testcase["caselevel"] = caselevel
Converts tier to caselevel.