<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pipinstall(packagename, pips=None, trypips=[], scripts=None):
 """ Install packages from pip. The primary advantage of using this function is that homely can automatically remove the package for you when you no longer want it. package: The name of the pip package to install pips: A list of `pip` executables to install the package with. `['pip2.7', 'pip3.4']` would install the package using both the `pip2.7` and `pip3.4` executables. The default is to use `['pip']` as long as you aren't using `trypips`. trypips: This is a supplementary list of `pip` executables that homely will use to install the package, but no exception will be raised if the `pip` executables aren't available. so that the packages are installed into your home directory. """

    # `scripts` is an alternate location for bin scripts. Useful for bad
    # platforms that put pip2/pip3 scripts in the same bin dir such that they
    # clobber each other.
    # FIXME: `scripts` still has the following issues
    # - useless if you're specifying multiple pips at once
    # - won't do the uninstall/reinstall dance to reinstall something that was
    #   installed with a different `scripts` path
    if scripts is None:
        scripts = {}
    if pips is None:
        pips = [] if len(trypips) else ['pip']
    engine = getengine()
    for pip in pips:
        helper = PIPInstall(packagename,
                            pip,
                            mustinstall=True,
                            scripts=scripts.get(pip))
        engine.run(helper)
    for pip in trypips:
        helper = PIPInstall(packagename,
                            pip,
                            mustinstall=False,
                            scripts=scripts.get(pip))
        engine.run(helper)