def get_environment(certificate):
    """Return environment associated with certificate. """

    STAGING_ENV = "Fake LE Intermediate X1"

    for component in certificate.get_issuer().get_components():
        if component[0] == 'CN':
            if component[1] == STAGING_ENV:
                return 'staging'
            else:
                return 'production'

    return None