Using the template provided at ipfs.py, create two functions…

Question Answered step-by-step Using the template provided at ipfs.py, create two functions… Using the template provided at ipfs.py, create two functions”pin_to_ipfs()” which takes a Python dictionary, and stores the dictionary (as JSON) on IPFS. The function should return the Content Identifier (CID) of the data stored.”get_from_ipfs(cid)” which takes as input an IPFS CID and returns a Python dictionary containing the content. For this function, you may assume the content identified by the CID is valid JSON content. For example, you may assume that the CID does not refer to an image, video or other type of binary content that cannot be easily JSONified.  import requestsimport jsondef pin_to_ipfs(data):   assert isinstance(data,dict), f”Error pin_to_ipfs expects a dictionary”   #YOUR CODE HERE   return ciddef get_from_ipfs(cid,content_type=”json”):   assert isinstance(cid,str), f”get_from_ipfs accepts a cid in the form of a string”   #YOUR CODE HERE     assert isinstance(data,dict), f”get_from_ipfs should return a dict”   return data Computer Science Engineering & Technology Python Programming Share QuestionEmailCopy link Comments (0)