def proof_req_briefs2req_creds(proof_req: dict, briefs: Union[dict, Sequence[dict]]) -> dict:
    """
    Given a proof request and cred-brief(s), return a requested-creds structure.

    The proof request must have cred def id restrictions on all requested attribute specifications.

    :param proof_req: proof request
    :param briefs: credential brief, sequence thereof (as indy-sdk wallet credential search returns),
        or cred-brief-dict (as HolderProver.get_cred_briefs_for_proof_req_q() returns); e.g.,

    ::

        [
            {
                "cred_info": {
                    "cred_rev_id": "149",
                    "cred_def_id": "LjgpST2rjsoxYegQDRm7EL:3:CL:15:tag",
                    "schema_id": "LjgpST2rjsoxYegQDRm7EL:2:bc-reg:1.0",
                    "rev_reg_id": "LjgpST2rjsoxYegQDRm7EL:4:LjgpST2rjsoxYegQDRm7EL:3:CL:15:tag:CL_ACCUM:1",
                    "referent": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "attrs": {
                        "busId": "11144444",
                        "endDate": "",
                        "id": "3",
                        "effectiveDate": "2012-12-01",
                        "jurisdictionId": "1",
                        "orgTypeId": "2",
                        "legalName": "Tart City"
                    }
                },
                "interval": {
                    "to": 1532448939,
                    "from": 1234567890
                }
            },
            ...
        ]

    :return: indy-sdk requested creds json to pass to proof creation request; e.g.,

    ::

        {
            "requested_attributes": {
                "15_endDate_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "revealed": true
                },
                "15_id_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "revealed": true
                },
                "15_effectiveDate_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "revealed": true
                },
                "15_busId_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "revealed": true
                },
                "15_orgTypeId_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "revealed": false
                },
                "15_jurisdictionId_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "revealed": true
                },
                "15_legalName_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "revealed": true
                }
            },
            "requested_predicates": {
                "15_orgTypeId_GE_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                }
            },
            "self_attested_attributes": {}
        }

    """

    rv = {
        'self_attested_attributes': {},
        'requested_attributes': {},
        'requested_predicates': {}
    }

    attr_refts = proof_req_attr_referents(proof_req)
    pred_refts = proof_req_pred_referents(proof_req)
    for brief in iter_briefs(briefs):
        cred_info = brief['cred_info']
        timestamp = (brief['interval'] or {}).get('to', None)
        for attr in cred_info['attrs']:
            if attr in attr_refts.get(cred_info['cred_def_id'], {}):
                req_attr = {
                    'cred_id': cred_info['referent'],
                    'revealed': attr not in pred_refts.get(cred_info['cred_def_id'], {}),
                    'timestamp': timestamp
                }
                if not timestamp:
                    req_attr.pop('timestamp')
                rv['requested_attributes'][attr_refts[cred_info['cred_def_id']][attr]] = req_attr
            if attr in pred_refts.get(cred_info['cred_def_id'], {}):
                for uuid in pred_refts[cred_info['cred_def_id']][attr]:
                    req_pred = {
                        'cred_id': cred_info['referent'],
                        'timestamp': timestamp
                    }
                    if not timestamp:
                        req_pred.pop('timestamp')
                    rv['requested_predicates'][uuid] = req_pred
    return rv
Given a proof request and cred-brief(s), return a requested-creds structure.

    The proof request must have cred def id restrictions on all requested attribute specifications.

    :param proof_req: proof request
    :param briefs: credential brief, sequence thereof (as indy-sdk wallet credential search returns),
        or cred-brief-dict (as HolderProver.get_cred_briefs_for_proof_req_q() returns); e.g.,

    ::

        [
            {
                "cred_info": {
                    "cred_rev_id": "149",
                    "cred_def_id": "LjgpST2rjsoxYegQDRm7EL:3:CL:15:tag",
                    "schema_id": "LjgpST2rjsoxYegQDRm7EL:2:bc-reg:1.0",
                    "rev_reg_id": "LjgpST2rjsoxYegQDRm7EL:4:LjgpST2rjsoxYegQDRm7EL:3:CL:15:tag:CL_ACCUM:1",
                    "referent": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "attrs": {
                        "busId": "11144444",
                        "endDate": "",
                        "id": "3",
                        "effectiveDate": "2012-12-01",
                        "jurisdictionId": "1",
                        "orgTypeId": "2",
                        "legalName": "Tart City"
                    }
                },
                "interval": {
                    "to": 1532448939,
                    "from": 1234567890
                }
            },
            ...
        ]

    :return: indy-sdk requested creds json to pass to proof creation request; e.g.,

    ::

        {
            "requested_attributes": {
                "15_endDate_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "revealed": true
                },
                "15_id_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "revealed": true
                },
                "15_effectiveDate_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "revealed": true
                },
                "15_busId_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "revealed": true
                },
                "15_orgTypeId_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "revealed": false
                },
                "15_jurisdictionId_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "revealed": true
                },
                "15_legalName_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                    "revealed": true
                }
            },
            "requested_predicates": {
                "15_orgTypeId_GE_uuid": {
                    "timestamp": 1532448939,
                    "cred_id": "43f8dc18-ac00-4b72-8a96-56f47dba77ca",
                }
            },
            "self_attested_attributes": {}
        }