def gmsh_code(path_or_code):
    """Generate mesh with gmsh."""
    try:
        from pygmsh import Geometry
    except ImportError:
        from pygmsh.built_in import Geometry
    geo = Geometry()
    if isinstance(path_or_code, list):
        code = map(str, path_or_code)
    else:
        try:
            with open(path_or_code, 'r') as gmsh_f:
                code = gmsh_f.readlines()
        except (OSError, IOError):
            print('gmsh_code: could not read file...')
            return geo
    geo.add_raw_code(code)
    return geo
