azure-keyvault/azure/keyvault/key_vault_id.py
def _format(self, fmt=None):
        """
        Formats the KeyVaultIdentifier into a identifier uri based of the specified format string
        :param fmt: The format string for the identifier uri 
        :return: The formatted key vault object identifier uri 
        """
        # if no fmt was specified use the _id_format from the current object
        fmt = fmt or self._id_format
        segments = []

        # split the formatting string into segments
        for fmt_seg in fmt.split('/'):
            # if the segment is a substitution element
            if fmt_seg.startswith('{') and fmt_seg.endswith('}'):

                # get the attribute name from the segment element
                fmt_seg = fmt_seg[1:-1]
                fmt_prop = fmt_seg.rstrip('?')
                # get the value of the attribute from the current object
                seg_val = getattr(self, fmt_prop)

                # if the attribute is specified add the value to the formatted segments
                if seg_val:
                    segments.append(seg_val.strip('/').strip())
                # if the attribute is not specified and the substitution is not optional raise an error
                else:
                    if not fmt_seg.endswith('?'):
                        raise ValueError('invalid id: No value specified for the required segment "{}"'.format(fmt_prop))

            # if the segment is a literal element simply add it to the formatted segments
            else:
                segments.append(fmt_seg)

        # join all the formatted segments together
        return '/'.join(segments)
def _format(self, fmt=None):
        """
        Formats the KeyVaultIdentifier into a identifier uri based of the specified format string
        :param fmt: The format string for the identifier uri 
        :return: The formatted key vault object identifier uri 
        """
        # if no fmt was specified use the _id_format from the current object
        fmt = fmt or self._id_format
        segments = []

        # split the formatting string into segments
        for fmt_seg in fmt.split('/'):
            # if the segment is a substitution element
            if fmt_seg.startswith('{') and fmt_seg.endswith('}'):

                # get the attribute name from the segment element
                fmt_seg = fmt_seg[1:-1]
                fmt_prop = fmt_seg.rstrip('?')
                # get the value of the attribute from the current object
                seg_val = getattr(self, fmt_prop)

                # if the attribute is specified add the value to the formatted segments
                if seg_val:
                    segments.append(seg_val.strip('/').strip())
                # if the attribute is not specified and the substitution is not optional raise an error
                else:
                    if not fmt_seg.endswith('?'):
                        raise ValueError('invalid id: No value specified for the required segment "{}"'.format(fmt_prop))

            # if the segment is a literal element simply add it to the formatted segments
            else:
                segments.append(fmt_seg)

        # join all the formatted segments together
        return '/'.join(segments)
Formats the KeyVaultIdentifier into a identifier uri based of the specified format string
        :param fmt: The format string for the identifier uri 
        :return: The formatted key vault object identifier uri