def validate_to_schema(nanopub, schema) -> Tuple[bool, List[Tuple[str, str]]]:
v = jsonschema.Draft4Validator(schema)<EOL>messages = []<EOL>errors = sorted(v.iter_errors(nanopub), key=lambda e: e.path)<EOL>for error in errors:<EOL><INDENT>for suberror in sorted(error.context, key=lambda e: e.schema_path):<EOL><INDENT>print(list(suberror.schema_path), suberror.message, sep="<STR_LIT:U+002CU+0020>")<EOL>messages.append(("<STR_LIT>", suberror.message))<EOL><DEDENT><DEDENT>is_valid = True<EOL>if errors:<EOL><INDENT>is_valid = False<EOL><DEDENT>return (is_valid, messages)<EOL>
Validate nanopub against jsonschema for nanopub

    Args:
        nanopub (Mapping[str, Any]): nanopub dict
        schema (Mapping[str, Any]): nanopub schema

    Returns:
        Tuple[bool, List[str]]:
            bool: Is valid?  Yes = True, No = False
            List[Tuple[str, str]]: Validation issues, empty if valid, tuple is ('Error|Warning', msg)
                e.g. [('ERROR', "'subject' is a required property")]