code: def validate(self, value):
          
          # obj can be None or a DataFrame
          if value is None:
              return True
          else:
              try:
                  with value.open() as hdulist:
                      self.validate_hdulist(hdulist)
              except Exception:
                  _type, exc, tb = sys.exc_info()
                  six.reraise(ValidationError, exc, tb)
docs: validate