def build_query_string(args):
    """Builds the query string that selects the script or library id for
    the required name and version

    """
    query_string = 'name=%s' % args.name
    try:
        version = args.name.split('-')[1].strip()
        return '%s;tags=%s' % (query_string, version)
    except IndexError:
        return query_string
