def model_params(model):
    """
    Create string of alphabetically sorted parameters of the model
    obtained with get_params or string contaning result of __repr__ call
    """
    s = ''
    if hasattr(model, 'get_params'):
        params_dict = model.get_params()
        max_len = 0
        for key in params_dict:
            if len(key) > max_len:
                max_len = len(key)
        sorted_keys = sorted(params_dict.keys())
        for key in sorted_keys:
            s += '%-*s %s\n' % (max_len, key, params_dict[key])
    elif hasattr(model, '__repr__'):
        s = model.__repr__()
        s += '\n'
    else:
        s = (
            'Model has no ability to show parameters (has no <get_params> or <__repr__>)\n'
            )
    s += '\n'
    return s
