On theorems of Beurling and Hardy for certain step two nilpotent groups