def _set_extra_info(extra_info):
    """Check input and return extra_info dictionary."""
    if extra_info is None:
        return {}
    if isinstance(extra_info, dict):
        return extra_info
    raise RuntimeError(
        "extra_info must be None or a dict, but got {}".format(extra_info)
    )