def gen_filename(endpoint):
    """Generate a filename from endpoint with timestamp.

    return: str
        hostname_port_YearMonthDay_HourMinSecFrac.h5
    """
    now = datetime.now().strftime('%Y%m%d_%H%M%S%f')[:-4]
    base = endpoint.split('://', 1)[1]
    if base.startswith('localhost:'):
        base = gethostname().split('.')[0] + base[9:]
    base = base.replace(':', '_').replace('/', '_')
    return '{}_{}.h5'.format(base, now)
def gen_filename ( endpoint ) : now = datetime . now ( ) . strftime ( '%Y%m%d_%H%M%S%f' ) [ : - 4 ] base = endpoint . split ( '://' , 1 ) [ 1 ] if base . startswith ( 'localhost:' ) : base = gethostname ( ) . split ( '.' ) [ 0 ] + base [ 9 : ] base = base . replace ( ':' , '_' ) . replace ( '/' , '_' ) return '{}_{}.h5' . format ( base , now )
Generate a filename from endpoint with timestamp.

    return: str
        hostname_port_YearMonthDay_HourMinSecFrac.h5