def search_basissets(data_base, args):
    """
    Take the args object and accordingly search for a basis
    set in the database
    """
    kwargs = {'regex': True, 'ignore_case': bool(args.ignorecase)}
    if args.elements:
        kwargs['has_atnums'] = list(args.elements)
    if args.name_regexp:
        kwargs['name'] = args.name_regexp
    if args.description_regexp:
        kwargs['description'] = args.description_regexp
    if args.pattern:
        kwargs['pattern'] = args.pattern
    if args.sources:
        kwargs['sources'] = args.sources
    return data_base.search_basisset(**kwargs)
