def box_from_string(content: str, string_type: str = "json") -> Union[Box, BoxList]:
    """
    Parse the provided string into a Box or BoxList object as appropriate.

    :param content: String to parse
    :param string_type: manually specify file type: json, toml or yaml
    :return: Box or BoxList
    """

    if string_type == "json":
        try:
            return Box.from_json(json_string=content)
        except JSONDecodeError:
            raise BoxError("File is not JSON as expected")
        except BoxError:
            return BoxList.from_json(json_string=content)
    elif string_type == "toml":
        try:
            return Box.from_toml(toml_string=content)
        except toml_decode_error:  # type: ignore
            raise BoxError("File is not TOML as expected")
        except BoxError:
            return BoxList.from_toml(toml_string=content)
    elif string_type == "yaml":
        try:
            return Box.from_yaml(yaml_string=content)
        except YAMLError:
            raise BoxError("File is not YAML as expected")
        except BoxError:
            return BoxList.from_yaml(yaml_string=content)
    else:
        raise BoxError(f"Unsupported string_string of {string_type}")

    Parse the provided string into a Box or BoxList object as appropriate.

    :param content: String to parse
    :param string_type: manually specify file type: json, toml or yaml
    :return: Box or BoxList
    
box/from_file.py