code: def is_valid_image(self, raw_data):
          
          with NamedTemporaryFile(mode='wb') as fp:
              fp.write(raw_data)
              fp.flush()
              args = settings.THUMBNAIL_IDENTIFY.split(' ')
              args.append(fp.name + '[0]')
              p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
              retcode = p.wait()
          return retcode == 0
docs: This is not very good for imagemagick because it will say anything is
          valid that it can use as input.