code: def convert_to_shape(x):
    
    if x is None:
      return None
    if isinstance(x, Shape):
      return x
    if isinstance(x, str):
      x = _parse_string_to_list_of_pairs(x, seconds_to_int=True)
    return Shape(x)
docs: Converts input to a Shape.
  
    Args:
      x: Shape, str, or None.
  
    Returns:
      Shape or None.
  
    Raises:
      ValueError: If x cannot be converted to a Shape.