Question: consider the following snippet

```
uri_match: Optional[Match[str]] = re.match(r"https//(.+?)/(.+)", "bla bla")

```

`re.match` has type `Match` or None.

```
res = uri_match.group(1)

```

This line says that `None` has no member `group`. Which means that the type checker sees that the return may be `None` and hence raises the error.
How do we deal with these?

Answer: 
You could use a function like this so you don't repeat code

```
function mkdir(data,file,p){
    var dir = path.join(data,file,p);
    if(!fs.existSync(dir)
        fs.mkdirSync(dir);
}

mkdir(data,file,path);
mkdir(another,file,path);
mkdir(yetanother,file,path);

```

Using an array you could do this

```
var arr = [path.join(data,file,p), path.join(another,file,p)];

function mkdir(p){
    if(!fs.existSync(p)
        fs.mkdirSync(p);
}

arr.forEach(mkdir);

```
I can't see any scope of improvement unless you want to write a new method to check the fs.existSync() {which is not a good idea}