def _ensure_dir(uri_to, key, port, user, host):
    directory = os.path.dirname(uri_to)
    cmd = [
        'ssh',
        '-i', key,
        '-p', str(port),
    ] + SSH_OPTIONS + [
        '{}@{}'.format(user, host),
        'mkdir', '-p', directory,
    ]
    _call(cmd)