def order(self, order):
        """Returns name order key.

        Returns tuple with two strings that can be compared to other such
        tuple obtained from different name. Note that if you want
        locale-dependent ordering then you need to compare strings using
        locale-aware method (e.g. ``locale.strxfrm``).

        :param order: One of the ORDER_* constants.
        :returns: tuple of two strings
        """
        given = self.given
        surname = self.surname
        if order in (ORDER_MAIDEN_GIVEN, ORDER_GIVEN_MAIDEN):
            surname = self.maiden or self.surname

        # We are collating empty names to come after non-empty,
        # so instead of empty we return "2" and add "1" as prefix to others
        given = ("1" + given) if given else "2"
        surname = ("1" + surname) if surname else "2"

        if order in (ORDER_SURNAME_GIVEN, ORDER_MAIDEN_GIVEN):
            return (surname, given)
        elif order in (ORDER_GIVEN_SURNAME, ORDER_GIVEN_MAIDEN):
            return (given, surname)
        else:
            raise ValueError("unexpected order: {}".format(order))
def order ( self , order ) : given = self . given surname = self . surname if order in ( ORDER_MAIDEN_GIVEN , ORDER_GIVEN_MAIDEN ) : surname = self . maiden or self . surname given = ( "1" + given ) if given else "2" surname = ( "1" + surname ) if surname else "2" if order in ( ORDER_SURNAME_GIVEN , ORDER_MAIDEN_GIVEN ) : return ( surname , given ) elif order in ( ORDER_GIVEN_SURNAME , ORDER_GIVEN_MAIDEN ) : return ( given , surname ) else : raise ValueError ( "unexpected order: {}" . format ( order ) )
Returns name order key.

        Returns tuple with two strings that can be compared to other such
        tuple obtained from different name. Note that if you want
        locale-dependent ordering then you need to compare strings using
        locale-aware method (e.g. ``locale.strxfrm``).

        :param order: One of the ORDER_* constants.
        :returns: tuple of two strings