code: def generate_format(self):
          
          with self.l('if isinstance({variable}, str):'):
              format_ = self._definition['format']
              if format_ in self.FORMAT_REGEXS:
                  format_regex = self.FORMAT_REGEXS[format_]
                  self._generate_format(format_, format_ + '_re_pattern', format_regex)
              # format regex is used only in meta schemas
              elif format_ == 'regex':
                  with self.l('try:'):
                      self.l('re.compile({variable})')
                  with self.l('except Exception:'):
                      self.l('raise JsonSchemaException("{name} must be a valid regex")')
              else:
                  self.l('pass')
docs: Means that value have to be in specified format. For example date, email or other.
  
          .. code-block:: python
  
              {'format': 'email'}
  
          Valid value for this definition is user@example.com but not @username