It is possible - if you'd look at the example scripts you'd see
@outputSchemaFunction("squareSchema")
def square(num):
return ((num)*(num))
and the calling example
b = foreach a generate myfuncs.square(3);
in your case the udf would be something like
@outputSchemaFunction("dow:long")
def get_week(format,source_date):
your code here