@staticmethod
def check_string(arg_name, arg_value, valid_values, prim_name):
    """Checks whether a string is in some value list"""
    if isinstance(arg_value, str) and arg_value in valid_values:
        return arg_value
    if len(valid_values) == 1:
        raise ValueError(
            f"For '{prim_name}' the `{arg_name}` should be str and must be {valid_values[0]}, but got {arg_value}."
            )
    raise ValueError(
        f"For '{prim_name}' the `{arg_name}` should be str and must be one of {valid_values}, but got {arg_value}."
        )
