async def METHOD_NAME(self, cid: str, timeout: int = 30):
    # ipfs pin add returns a dictionary with a progress report in terms of blocks
    # and a "Pins" key if the pinning is complete. The dictionary is empty if the daemon
    # cannot find the file on the network.
    # A value is returned every half second by the daemon. We consider that the operation
    # fails if the same value is returned timeout * 2 times.
    # This assumes that the daemon progress never goes backwards.
    tick_timeout = timeout * 2
    last_progress = None
    async for status in self.ipfs_client.pin.add(cid):
        # If the Pins key appears, the file is pinned.
        if "Pins" in status:
            break
        progress = status.get("Progress")
        if progress == last_progress:
            tick_timeout -= 1
            if tick_timeout == 0:
                if progress is None:
                    details = "file not found"
                else:
                    details = "could not fetch some blocks"
                raise FileUnavailable(f"Could not pin IPFS content at this time ({details})")
        else:
            # Reset the timeout counter if there is some measure of progress
            tick_timeout = timeout * 2