def _parse_dbpath(dbpath):
        """Converts the dbpath to a regexp pattern.

        Transforms dbpath from a string or an array of strings to a
        regexp pattern which will be used to match database names.

        Args:
            dbpath: a string or an array containing the databases to be matched
                from a cluster.

        Returns:
            A regexp pattern that will match any of the desired databases on
            on a cluster.
        """
        if isinstance(dbpath, list):
            # Support dbpath param as an array.
            dbpath = '|'.join(dbpath)

        # Append $ (end of string) so that twit will not match twitter!
        if not dbpath.endswith('$'):
            dbpath = '(%s)$' % dbpath

        return dbpath
Converts the dbpath to a regexp pattern.

        Transforms dbpath from a string or an array of strings to a
        regexp pattern which will be used to match database names.

        Args:
            dbpath: a string or an array containing the databases to be matched
                from a cluster.

        Returns:
            A regexp pattern that will match any of the desired databases on
            on a cluster.