<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def signRequest(self, req: Request, identifier: Identifier=None) -> Request: """ Signs request. Modifies reqId and signature. May modify identifier. :param req: request :param requestIdStore: request id generator :param identifier: signer identifier :return: signed request """


        idr = self.requiredIdr(idr=identifier or req._identifier)
        # idData = self._getIdData(idr)
        req._identifier = idr
        req.reqId = req.gen_req_id()
        # req.digest = req.getDigest()
        # QUESTION: `self.ids[idr]` would be overwritten if same identifier
        # is used to send 2 requests, why is `IdData` persisted?
        # self.ids[idr] = IdData(idData.signer, req.reqId)
        req.signature = self.signMsg(msg=req.signingPayloadState(identifier=idr),
                                     identifier=idr,
                                     otherIdentifier=req.identifier)

        return req