def getEnvironmentFromNameAndProtocol(studyname, protocolname):
    """
    Extract environment name using studyname and protocolname to guide
    :param str studyname: Name of the study (including Env)
    :param str protocolname: Name of the study
    """
    # StudyName =    "TEST (1) (DEV)"
    # ProtocolName = "TEST (1)"
    # Raw Env      =           "(DEV)"

    raw_env = studyname[len(protocolname) :].strip()

    if "(" in raw_env:
        l_brace_pos = raw_env.rfind("(")
        r_brace_pos = raw_env.rfind(")")
        return raw_env[l_brace_pos + 1 : r_brace_pos]
    else:
        return raw_env