code: def convert_to_layout_rules(x):
    
    if isinstance(x, LayoutRules):
      return x
    if isinstance(x, str):
      x = _parse_string_to_list_of_pairs(x)
    return LayoutRules(x)
docs: Converts input to a LayoutRules.
  
    Args:
      x: LayoutRules, str, or set-like of string pairs.
  
    Returns:
      LayoutRules.