def get_string_by_card(all_strings, card=None, string_number=None):
    """Reduce the boundary_strings dataframe to a single card type or
    a single string number

    Args:
        all_strings: dataframe
            AdhSimulation.BoundaryCondition.boundary_strings dataframe
        card: string
            String card to extract from the dataframe (e.g. 'EGS', 'NDS', 'MTS')
        string_number: integer
            Number of the string to extract

    Returns:
        subset - dataframe
            subset dataframe containing only the requested cards and/or string

    """
    if card:
        card_condition = all_strings['CARD'] == card
    else:
        card_condition = all_strings['CARD'].notnull()

    if string_number:
        string_number_condition = all_strings['ID_1'] == string_number
    else:
        string_number_condition = all_strings['ID_1'].notnull()

    subset = all_strings.loc[card_condition & string_number_condition]

    return subset