@staticmethod
def _validate_key(key):
    """Emit a warning or raise an exception if key is invalid. Returns key."""
    if '.' in key:
        from ..errors import InvalidKeyError
        raise InvalidKeyError("Keys may not contain dots ('.').")
    return key
