<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add(args):
 """ cdstarcat add SPEC Add metadata about objects (specified by SPEC) in CDSTAR to the catalog. SPEC: Either a CDSTAR object ID or a query. """

    spec = args.args[0]
    with _catalog(args) as cat:
        n = len(cat)
        if OBJID_PATTERN.match(spec):
            cat.add_objids(spec)
        else:
            results = cat.add_query(spec)
            args.log.info('{0} hits for query {1}'.format(results, spec))
        args.log.info('{0} objects added'.format(len(cat) - n))
        return len(cat) - n