def get_var_names(component, intent='input'):
    """
    Get a list of input or output variable names from *component* (a BMI-like
    object). Use the *intent* keyword to specify whether to return input or
    output variable names. *intent* must be one of *input* or *output*.
    """
    assert(intent in ['input', 'output'])

    func = getattr(component, 'get_' + intent + '_var_names')
    try:
        var_names = func()
    except TypeError:
        var_names = getattr(component, '_' + intent + '_var_names')

    return var_names