def get_identifier(positioner_id, command_id, uid=0, response_code=0):
    """Returns a 29 bits identifier with the correct format.

    The CAN identifier format for the positioners uses an extended frame with
    29-bit encoding so that the 11 higher bits correspond to the positioner
    ID, the 8 middle bits are the command number, the following 6 bits are the
    unique identifier, and the 4 lower bits are the response code.

    Parameters
    ----------
    positioner_id : int
        The Id of the positioner to command, or zero for broadcast.
    command_id : int
        The ID of the command to send.
    uid : int
        The unique identifier
    response_code : int
        The response code.

    Returns
    -------
    identifier : `int`
        The decimal integer corresponding to the 29-bit identifier.

    Examples
    --------
    ::

        >>> get_identifier(5, 17, uid=5)
        1328128
        >>> bin(1328128)
        '0b101000100010000000000'

    """

    posid_bin = format(positioner_id, "011b")
    cid_bin = format(command_id, "08b")
    cuid_bin = format(uid, "06b")
    response_bin = format(int(response_code), "04b")

    identifier = posid_bin + cid_bin + cuid_bin + response_bin

    assert len(identifier) == 29

    return int(identifier, 2)