<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def usearchdb(fasta, alignment = 'local', usearch_loc = 'usearch'):
 """ make usearch db """

    if '.udb' in fasta:
        print('# ... database found: %s' % (fasta), file=sys.stderr)
        return fasta
    type = check_type(fasta)
    db = '%s.%s.udb' % (fasta.rsplit('.', 1)[0], type)
    if os.path.exists(db) is False:
        print('# ... making usearch db for: %s' % (fasta), file=sys.stderr)
        if alignment == 'local':
            os.system('%s -makeudb_ublast %s -output %s >> log.txt' % (usearch_loc, fasta, db))
        elif alignment == 'global':
            os.system('%s -makeudb_usearch %s -output %s >> log.txt' % (usearch_loc, fasta, db))
    else:
        print('# ... database found for: %s' % (fasta), file=sys.stderr)
    return db