def get_field_value_by_dotpath(
        self, folder, field_name, raw=False, formatted=False
    ):
        fields = folder.get_fields()

        key_dotpath = None
        if '.' in field_name:
            field_name, key_dotpath = field_name.split('.', 1)

        if field_name not in fields:
            raise JirafsError("Field '%s' does not exist." % field_name)

        if raw:
            data = fields[field_name]
        else:
            data = fields.get_transformed(field_name)

        if key_dotpath:
            try:
                for component in key_dotpath.split('.'):
                    if not isinstance(data, dict):
                        raise JirafsError(
                            "Key '%s' (of dotpath '%s') is not an object "
                            "in field '%s'." % (
                                component,
                                key_dotpath,
                                field_name,
                            )
                        )
                    elif component not in data:
                        data = ''
                        break
                    else:
                        data = data[component]
            except (__HOLE__, TypeError):
                raise JirafsError(
                    "Field '%s' could not be parsed as JSON for retrieving "
                    "dotpath '%s'." % (
                        field_name,
                        key_dotpath,
                    )
                )

        return data
dataset/ETHPy150Open coddingtonbear/jirafs/jirafs/commands/field.py/Command.get_field_value_by_dotpath