Let $\text{SSR}$ denote the sum of squared residuals and $\text{WSSR}$ the weighted $\text{SSR}$. Standard OLS-regression approach minimizes the $\text{SSR}$ with $y$ as the dependent and $y$ as the independent variable:
$$\text{SSR}(\beta) = \sum^n_{i=1}{(y_i - \hat{x}_i \cdot \beta)^2}$$
The WLS-approach adds a weight $w$ for each of the observations $x_i$. OLS-regression is the special case of WLS when applying $w=1$ for all $x_i$. WLS minimizes the weighted $\text{SSR}$:
$$\text{SSR}(\beta, w) = \sum^n_{i=1}{w \cdot (y_i - \hat{x}_i \cdot \beta)^2}$$
If your weights $w_i$ are the squared root of firms $i$ market cap, this results in:
$$\text{SSR}(\beta, w) = \sum^n_{i=1}{\sqrt{MV_i} \cdot (y_i - \hat{x}_i \cdot \beta)^2}$$
where $MV_i$ is the market capitalization of firm $i$. As a result, the weight $w$ still remains the "squared" root and not the "fourth".
In Python, WLS with weights from one to seven is applied as:
import statsmodels.api as sm
Y = [1,3,4,5,2,3,4]
X = range(1,8)
X = sm.add_constant(X)
wls_model = sm.WLS(Y,X, weights=list(range(1,8)))
results = wls_model.fit()
results.params
array([ 2.91666667, 0.0952381 ])
Whereas in R, you just run:
y <- c(1,3,4,5,2,3,4)
x <- 1:7
summary(lm(y ~ x , weights = 1:7))