def get_pk(row: 'md_table.Table', as_tuple: bool=True):
    """
    Gets the primary key for a Table row.

    :param row: The :class:`.Table` instance to extract the PK from.
    :param as_tuple: Should this PK always be returned as a tuple?
    """
    pk = row.primary_key
    if as_tuple and not isinstance(pk, tuple):
        return pk,
    return pk
