This part could be rewritten as
```python
elif fileobj is not None:
    context = utils.mkbuildcontext(fileobj)
elif path.startswith(('http://', ...)):
    ...
```

and save us an extra level of indentation.