def _validate_license(model):
license_mapping = obtain_licenses()<EOL>try:<EOL><INDENT>license_url = model.metadata['<STR_LIT>']<EOL><DEDENT>except KeyError:<EOL><INDENT>raise exceptions.MissingRequiredMetadata('<STR_LIT>')<EOL><DEDENT>try:<EOL><INDENT>license = license_mapping[license_url]<EOL><DEDENT>except KeyError:<EOL><INDENT>raise exceptions.InvalidLicense(license_url)<EOL><DEDENT>if not license['<STR_LIT>']:<EOL><INDENT>raise exceptions.InvalidLicense(license_url)<EOL><DEDENT>
Given the model, check the license is one valid for publication.