<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def build_docs(location="doc-source", target=None, library="icetea_lib"):
 """ Build documentation for Icetea. Start by autogenerating module documentation and finish by building html. :param location: Documentation source :param target: Documentation target path :param library: Library location for autodoc. :return: -1 if something fails. 0 if successfull. """

    cmd_ar = ["sphinx-apidoc", "-o", location, library]
    try:
        print("Generating api docs.")
        retcode = check_call(cmd_ar)
    except CalledProcessError as error:
        print("Documentation build failed. Return code: {}".format(error.returncode))
        return 3
    except OSError as error:
        print(error)
        print("Documentation build failed. Are you missing Sphinx? Please install sphinx using "
              "'pip install sphinx'.")
        return 3

    target = "doc{}html".format(os.sep) if target is None else target
    cmd_ar = ["sphinx-build", "-b", "html", location, target]
    try:
        print("Building html documentation.")
        retcode = check_call(cmd_ar)
    except CalledProcessError as error:
        print("Documentation build failed. Return code: {}".format(error.returncode))
        return 3
    except OSError as error:
        print(error)
        print("Documentation build failed. Are you missing Sphinx? Please install sphinx using "
              "'pip install sphinx'.")
        return 3
    print("Documentation built.")
    return 0