def METHOD_NAME(context):
    """Given a request, return the appropriate affiliate for Search.gov.
    Our default affiliate code is "cfpb". We have a separate Spanish-language
    index named "cfpb_es". We then have two additional indexes, "cfpb_beta"
    and "cfpb_beta_es", for use on beta.consumerfinance.gov.
    """
    affiliate = "cfpb"
    if environment_is("beta"):
        affiliate += "_beta"
    language = context.get("language")
    if language == "es":
        affiliate += "_es"
    return affiliate