def METHOD_NAME(rundir, log):
    '''Generates an array of leap second dates.
    The array is automatically updated every six months.
    Uses a local leap second file, but retrieves a leap
    second file from NIST if the current file is missing
    or out of date.
    Parameters
    ----------
    rundir : str
        The folder in which to cache the leapdates array.
    log : logedit.Logedit
        The current log.
    Returns
    -------
    ndarray
        The Julian dates of leap seconds.
    '''
    ntpepoch = 2208988800
    if not os.path.isdir(rundir):
        # Make the leapdir folder if needed
        os.mkdir(rundir)
    files = os.listdir(rundir)
    if len(files) != 0:
        recent = np.sort(files)[-1]
        with open(rundir+recent, 'r') as nist:
            doc = nist.read()
        table = doc.split('#@')[1].split('\n#\n')[1].split('\n')
        expiration = float(doc.split('#@')[1].split('\n')[0][1:])
    else:
        expiration = -np.inf
    if time.time() + ntpepoch > expiration:
        log.writelog("  Leap-second file expired. Retrieving new file.",
                     mute=True)
        try:
            with urllib.request.urlopen('ftp://ftp.boulder.nist.gov/'
                                        'pub/time/leap-seconds.list') as nist:
                doc = nist.read().decode()
            use_fallback = False
        except:
            # FINDME: Need to only catch the expected exception.
            # Couldn't connect to the internet, so use the local array
            # defined below
            use_fallback = True
        if not use_fallback:
            newexp = doc.split('#@')[1].split('\n')[0][1:]
            # Remove non-alphanumeric characters with regular expressions
            newexp = re.sub(r'\W+', '', newexp)
            with open(rundir+"leap-seconds."+newexp, 'w') as newfile:
                newfile.write(doc)
            table = doc.split('#@')[1].split('\n#\r\n')[1].split('\n')
            log.writelog("  Leap second file updated.", mute=True)
    else:
        use_fallback = False
        log.writelog("  Local leap second file retrieved.", mute=True)
        t_next = time.asctime(time.localtime(expiration-ntpepoch))
        log.writelog(f"  Next update: {t_next}", mute=True)
    if not use_fallback:
        ls = np.zeros(len(table))
        for i in range(len(table)):
            ls[i] = float(table[i].split('\t')[0])
        jd = ls/86400+2415020.5
        return jd
    else:
        log.writelog('  NIST leap-second file not available. '
                     'Using stored table.')
        return np.array([2441316.5, 2441498.5, 2441682.5, 2442047.5,
                         2442412.5, 2442777.5, 2443143.5, 2443508.5,
                         2443873.5, 2444238.5, 2444785.5, 2445150.5,
                         2445515.5, 2446246.5, 2447160.5, 2447891.5,
                         2448256.5, 2448803.5, 2449168.5, 2449533.5,
                         2450082.5, 2450629.5, 2451178.5, 2453735.5,
                         2454831.5, 2456108.5, 2457203.5, 2457753.5])+1