def download(input, filename, format='sdf', overwrite=False, resolvers=None, **kwargs):
    """ Resolve and download structure as a file """
    kwargs['format'] = format
    if resolvers:
        kwargs['resolver'] = ",".join(resolvers)
    url = API_BASE+'/%s/file?%s' % (urlquote(input), urlencode(kwargs))
    try:
        servefile = urlopen(url)
        if not overwrite and os.path.isfile(filename):
            raise IOError("%s already exists. Use 'overwrite=True' to overwrite it." % filename)
        file = open(filename, "w")
        file.write(servefile.read())
        file.close()
    except urllib.error.HTTPError:
        # TODO: Proper handling of 404, for now just does nothing
        pass
Resolve and download structure as a file