code: def dumps(self, obj):
          
          out = BytesIO()
          try:
              self.dump(obj, out)
              return out.getvalue()
          finally:
              out.close()
docs: Serializes obj to an avro-format byte array and returns it.